MVC Simple Model In ASP.NET

In our previous article we have learnt basics of MVC , now in this article we will learn how to make simple model In MVC.

  • Create New ASP.NET MVC 4 Web Application .
  • Select Internet Website as template.
  • Select ASP.NET as  View Engine
  • Right Click on the model -> Add New Item ->Class -> Movies.cs
MovieModel

  • Build your Application.
  • Right Click on Controller->Add new item -> MovieController
  • Import your model namespace and prepare as shown below.
  • Right click on Action ->Add new View ->Select Strongly typed View ->Select your Model Class->Select Empty template
MovieController
  • The advantage of creating strongly typed View is now you can get the properties of class in view by typing the model and ‘.  (‘dot’).
DiplayMovie
Output…….
OutputMovie
Happy Coding!!

 

Leave a Reply

Your email address will not be published. Required fields are marked *