Feb 21, 2014

Action Methods in ASP.NET MVC

Actually MVC application determines the corresponding controller by using routing rules defined in Global.asax. And controllers have specific methods for each user actions. Each request coming to controller is for a specific ActionMethod. The following code example, “ShowBooks” is an example of an Action method.


public ViewResult ShowBooks(int id)
{
  var computerBook = db.Books.Where(p => P.BookID == id).First();
  return View(computerBook);
}

No comments:

Post a Comment