The controller (Ccontroller) in the MVC pattern primarily corresponds to the user's input, and the model is modified as appropriate, and the input data (View) should be considered the soul element of the MVC3 core element.
The traditional webform is that the user is using the HTML page on the server disk of the browser and MVC is different, MVC is the way to get the appropriate action method (action) and provide parameters for the method, and then the method determines what view to use
and renders for the view.
Simply create a controller
public class Homecontroller:controller { //// GET:/home/public string Index () { return ' This Index "; } public string Detail (string name) { return ' this Detail ' + name; } public string Create () { return ' this create '; } }
We can see that this is a very concise approach that only inherits the base class of the controller.
Where the index method is the underlying method of the detail browser trigger event,
We enter in the browser
Http://localhost:57950/Home
The mechanism for routing through MVC is then matched to the index method
Http://localhost:57950/Home/Detail
The same principle will match the corresponding detail method.
Http://localhost:57950/Home/Detail/5
If the connection contains parameters, the modification method can also accept the parameters
There's another way to accept it.
Http://localhost:57950/Home/Detail?name=MVC
Here's a brief talk about how the controller works and how to access it.
MVC Controller Brief Introduction (internal use)