Knowledge Management Banner

Knowledge Management Banner

Selectors , Models , Helpers in MVC : Part 3

Selectors

  • Action selectors are the attributes that help action method to be invoked to a particular request

There are three types of action selectors

  • Action Name
  • Non Action
  • Action Verb
Action Name

It is used to give name for an action. It allows developers to use different action name than method name
e.g.
[ActionName("CurrentTime")]
public string GetCurrentTime()
{
}

Non Action

This is a built in attribute which is used to indicate that the method is not an action.
e.g.
[NonAction]
public string GetTime()
{
}

ActionVerb

Another selector field that can be applied is Action Verb
  • HttpGet
  • HttpPost
  • HttpPut
  • HttpDelete
  • HttpOptions
  • HttpPatch
If the two action method are declared with same name but with different action verb than it will respond to that particular action verb.

Model in MVC

A model stores a data that is fetched according to commands from controller and displayed in view.

Helpers

Helpers are used to create HTML controls and elements programatically.

No comments

Powered by Blogger.