1 Create ASP.NET MVC Application
2 Create WebAPI
3 Change Index.cshtml
4 Check result
2 Create WebAPI
public class MoviesController : ApiController { public IEnumerableGet() { return new List { new Movie {Id=1, Title="Star Wars", Director="Lucas"}, new Movie {Id=2, Title="King Kong", Director="Jackson"}, new Movie {Id=3, Title="Memento", Director="Nolan"} }; } public string Get(int id) { return "value"; } public void Post([FromBody]string value) { } public void Put(int id, [FromBody]string value) { } public void Delete(int id) { } }
3 Change Index.cshtml
@{ ViewBag.Title = "Home Page"; } @section scripts { }
Title Director {{movie.Title}} {{movie.Director}}
4 Check result
No comments:
Post a Comment
Note: only a member of this blog may post a comment.