Action Selectors have used in Asp.net MVC action methods and these attributes applied to action methods. it decides which action method gets invoked in response to the HTTP request and should be matched with the method name in the request URL.
Types of Action Selectors
There are mainly 3 attributes are available in MVC5- ActionName
- NonAction
- ActionVerbs
Example of Action Selectors
public class ATGController : Controller { [ActionName("check")] public ActionResult CheckById(int id) { // check from the database return View(); } } |
---|
NonAction selectors are the methods of controller. they are not action methods.
Example for NonAction Selector
public class ATGController : Controller
{
[NonAction]
public CheckById(int id)
{
return checkList.Where(s => s.CheckId ==id).FirstOrDefault();
}
}
|
---|
Post a Comment (0)