I’m sorry to ask such a basic question, but it’s kind of fundamental for me. To better understand filters, I need to understand this notions. Although I’m on ASP.NET MVC for few months now and now are doing nice demos, I’m more familiar with Action method concept than action result.
What are:
- Action Method?
- Action Result?
- How are they related?
Let’s say I’ve this
public ViewResult ShowPerson(int id)
{
var friend = db.Persons.Where(p => P.PersonID == id).First();
return View(friend);
}
How those concepts apply to the above code?
Thanks for helping.
In your example
ShowPersonis the action. Each action needs to return an action result (In your case it returns a view). So when a controller action method is invoked it does some processing and decides what view would be best adapted to represent the model.There are many different action results that you might use. They all derive from ActionResult: