Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ASP.NET MVC - Beyond "WTF is a controller?"

ASP.NET MVC - Beyond "WTF is a controller?"

Avatar for Philip Proplesch

Philip Proplesch

December 06, 2013

More Decks by Philip Proplesch

Other Decks in Programming

Transcript

  1. public class FooBarAttribute : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext

    filterContext) { } public override void OnActionExecuted(ActionExecutedContext filterContext) { } }
  2. [Display(ResourceType = typeof(Labels), Name = "UserName")] public string UserName {

    get; set; } [Display(ResourceType = typeof(Labels), Name = "Password")] public string Password { get; set; }
  3. routes.MapRoute( name: "Default", url: "{language}/{controller}/{action}/{id}", defaults: new { language =

    "en", controller = "Home", action = "Index", id = UrlParameter.Optional } );
  4. [RoutePrefix("products")] public class ProductController : Controller { [Route("all")] public ActionResult

    List() { } [Route("{slug}")] public ActionResult Details(string slug) { } [Route("{slug}/reviews")] public ActionResult Reviews(string slug) { } }
  5. public class FooModelBinder : IModelBinder { public object BindModel( ControllerContext

    controllerContext, ModelBindingContext bindingContext) { // ... } }