Documente Academic
Documente Profesional
Documente Cultură
Module Overview
Implementing MVC Controllers Creating Action Methods
Models
Views Views are the components that display the applications user interface (UI)
Controllers
Model objects are the parts of the application that implement the logic for the applications data domain
Controllers are the components that handle user interaction, work with the model, and select a view to render the UI
Add action methods for Create, Update, Delete and Details scenarios
Action filters are custom attributes that provide a declarative means to add pre-action and post-action behavior to controller action methods.
Authorization filters Make security decisions about whether to execute an action method. Action filters Wrap the action method execution. Result filters Wrap the ActionResult. Exception Filters Execute if there is an unhandled exception thrown in the action method.
An action method is a public method of a controller that can have any number of parameters and typically returns an object of type ActionResult. Typically, it calls the view and passes data to the view via the ViewData object.
Action methods cannot be overloaded based on parameters unless they are disambiguated with attributes such as NonActionAttribute or AcceptVerbsAttribute.
[HttpPost] public ActionResult Create(Blog blog) { if (ModelState.IsValid) { // TODO: Add insert logic here }; return RedirectToAction("Index"); }
Logon information
Lab Scenario
Lab Review
Review Questions
Best Practices