public class Book {
public int Id { get; set; }
public string Author { get; set; }
public string Title { get; set; }
public string Link { get; set; }
}
public static class Books {
public static List<Book> List = new List<Book> {
new Book {Id = 1, Author = "John Robb", Title = "Punk Rock: An Oral History"},
new Book {
Id = 2,
Author = "Daniel Mohl",
Title = "Building Web, Cloud, and Mobile Solutions with F#" },
new Book {
Id = 3,
Author = "Steve Clarke",
Title = "100 Things Blue Jays Fans Should Know & Do Before They Die" },
new Book {
Id = 4,
Author = "Mark Frank",
Title = "Cuban Revelations: Behind the Scenes in Havana " }
};
}
public class RouteConfig {
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "BookPage",
url: "books/details/{id}",
defaults: new {controller = "BooksPage", action = "Details"}
);
}
}
public static class WebApiConfig {
public static void Register(HttpConfiguration config)
{
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new {id = RouteParameter.Optional}
);
}
}
,