I want to have 2 models in one view. The page contains both LoginViewModel
and RegisterViewModel
.
e.g.
pub
a simple way to do that
we can call all model first
@using project.Models
then send your model with viewbag
// for list
ViewBag.Name = db.YourModel.ToList();
// for one
ViewBag.Name = db.YourModel.Find(id);
and in view
// for list
List Name = (List)ViewBag.Name ;
//for one
YourModel Name = (YourModel)ViewBag.Name ;
then easily use this like Model