public ActionResult Create(EquipmentCreateModel model) { if (ModelState.IsValid) { Camera _camera = new Camera { ApplicationUser = um.FindById(model.ApplicationUserId), EquipmentName = model.EquipmentName, SerialNumber = model.SerialNumber, PurchasePrice = model.PurchasePrice, isCheckedOut = false }; db.Cameras.Add(_camera); db.SaveChanges(); return RedirectToAction("Index"); } // Validation failed, reassign the list without assigning anything string selectId = model.ApplicationUserId; model.Users = FullNameUserList(db, selectId); return View(model); }
public ActionResult Create() { EquipmentCreateModel model = new EquipmentCreateModel(); string selectId = User.Identity.GetUserId(); model.Users = FullNameUserList(db, selectId); return View(model); }