ASP.Net MVC | mvc post model
InthisarticleIwillexplainwithanexample,howtosubmit(post)aFormandsenddatafromViewtoControllerinASP.NetMVC5. ThisarticlewillexplainhowtocreateFormFieldsusingModelclassandthensenddatafromViewtoControllerusingModelclassobjectinASP.NetMVC5. Model FollowingisaModelclassnamedPersonModelwithfourpropertiesi.e.PersonId,Name,GenderandCity. publicclassPersonModel { ///
In this article I will explain with an example, how to submit (post) a Form and send data from View to Controller in ASP.Net MVC 5.
This article will explain how to create Form Fields using Model class and then send data from View to Controller using Model class object in ASP.Net MVC 5.
Model
Following is a Model class named PersonModel with four properties i.e. PersonId, Name, Gender and City.
public class PersonModel
{
///<summary>
/// Gets or sets PersonId.
///</summary>
public int PersonId { get; set; }
///<summary>
/// Gets or sets Name.
///</summary>
public string Name { get; set; }
///&l...