Presentation is loading. Please wait.

Presentation is loading. Please wait.

Model View Controller in the ASP World

Similar presentations


Presentation on theme: "Model View Controller in the ASP World"— Presentation transcript:

1 Model View Controller in the ASP World

2 Introduction ASP is but one MVC / RESTful framework
And it has been undergoing a lot of changes We will use MVC 5 MVC 6 is just about out and converges many of the current “ways of doing things”

3 ASP 5.0 Programming Model System.Web. Http.ApiController
System.Web. MVC.Controller

4 MVC Project Types xx

5 Web API Project

6 MVC Project

7 And now the Gory Details
The model contains the data There is no view because we are going to return serialized JSON You will see how to consume this in a bit The controller does all of the work

8 The Model It’s a simple class that contains data
This data is returned through the controller

9 Routings Recall that MVC uses routings to figure out the controller, methods, and argument to call And it’s a bit magical

10 MVC Routes (1) Routes provide the mechanism to map URLs into a corresponding call to a controller function Roughly speaking, the format of a route is /api/{controller}/{action}/{id}

11 MVC Routes (2)

12 MVE Routes (3)

13 Controller Names Are magical
Must be the controller name followed by the word Controller

14 Method Names Method names begin with HTTP verbs
The following are all get The infrastructure calls the correct method based on the signature

15 Method Names Don’t try this
The service won’t know which method to call

16 Method Names Get one data item


Download ppt "Model View Controller in the ASP World"

Similar presentations


Ads by Google