How to use ViewModels in ASP.NET MVC?
I just started learning about ViewModels in ASP.NET MVC. So, I thought of implementing a sample example as below: Business Entity public class AddModel { public int a { get; set; } public int b { get; set; } public int Add() { return (this.a + this.b); } } Add ViewModel public class AddViewModel { public AddModel addModel; public int Total { get; set; } } Controller public class AddController : Controller { [HttpPost] public JsonResult Add(AddViewModel model) { int iSum = model.addModel.a + model.addModel.b; model.Total = iSum; return Json(model); } public ActionResult Index() { return View();