Asp Net Core Mvc

Posted By admin On 05.02.20
MvcAsp Net Core Mvc

Asp.net Core Mvc Login

Here we will learn what is viewmodel in asp.net mvc and how to use viewmodel in asp.net mvc applications with example. ViewModel in Asp.Net MVCThe viewmodel in asp.net mvc represent only the data we want to display on view whether it is used for displaying or for taking input from view. If we want to display more than one model on view in asp.net mvc then we need to create a new viewmodel. Following image shows visual representation of view model in asp.net mvc.Here we will learn asp.net mvc viewmodel with simple example if we have a Customer entity and Order entity. In view to display both entities (Customer entity + Order entity) data then we need to create viewmodel (CustomerVM) and we will select the properties whichever we want to display from both entities (Customer entity + Order entity) and create a viewmodel.Now start with creating a viewmodel in asp.net mvc before that let's have look on table which we are going to use in our application. Database PartIn this database part we will create required tables in database with following scripts. Customer Tablefollowing is the script to create customer table in your database.