Creating the new MVC project in visual studio and using View Data

Creating the new MVC project in Visual Studio 2015

  • Open Visual Studio
  • Goto File -> New -> Project
  • Select Templates-> Visual C#-> Web -> Asp.NET Web Application
  • Give project Name(Any Name you Want, I Used "MvcWebApp")



Adding a Controller into the project

  • Goto Solution Explorer -> Right Click On Controller Folder
  • Add-> Controller -> Select MVC5 Controller-Empty(In Add Scaffold Box)
  • Give the name for controller HomeController (Suffix xxController mandatory.) 
  • It will generate following code with one Action Method.
  • Now right click on Action Method And select Add View
  • It will Add Index.cshtml int directory Views/Home/ in Solution Explorer.
  • Now Add some code to Action Method
  • Code for Index.cshtml
 

Comments

Popular posts from this blog

Code First Approach with Entity Framework

Getting Ready for Python Development on Ubuntu using VSCode

Designing Model class with validation in ASP.NET MVC