Skip to content

Latest commit

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Action Controllers

Getting Started

  1. Create folders in your Controllers directory. The last part of the namespace (folder name) will represent the Controller name (by default).

  2. The name of the class is the action (by default).

  3. The method names will match the HTTP method that was used to request the resource (similar to webapi).

  4. Configure where to find your actions and how to resolve them.

##Examples

Controller Action Setup

Basic Setup

protectedvoidApplication_Start(){ActionControllers.Setup(x =>x.FindActionsFromCurrentAssembly());}

Advanced Setup (using Structuremap as the IOC container)

protectedvoidApplication_Start(){ActionControllers.Setup(x =>{x.FindActionsFromCurrentAssembly();x.FindActionsFromAssemblyContaining<Index>();x.IncludeActionsWhere(x=>x.Namespace.Contains("Controllers"));x.UsingNamingConventions(newDefaultNamingConventions());x.ResolveActionsBy(ObjectFactory.GetInstance);});}

Controller Example

namespaceExample.Controllers.Home{publicclassIndex:ActionController{publicActionResultGet(){ViewBag.Message="Welcome to ActionControllers";returnView();}publicActionResultPost(stringq){returnRedirectToGet();}}}

About

A way to reduce controller clutter

Resources

Stars

10 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages