What is ActionResult in MVC?
What is ActionResult in MVC?
The action result implementation then deals with the Response object for you, generating the output that corresponds to your intention.
Step 1:
Create simple empty project in VS 2012.
Now Select basic from Template project
Step 2:
Now add controller to our solution
Give name HomeController & select Empty MVC Controller from Scaffolding options.
Step 3:
Write bellow code in ActionResult
public ActionResult Index()
{
return Content("Welcome to
my first MVC application");
}
Now right click on above method => click add view as like bellow figure
Now you will see below window & click
on Add
Step 4:Now run the application & you will get
output as like this.
0 comments: