public ActionResult Create(StatusChanx statuschanx) { if (ModelState.IsValid) { db.StatusChanges.Add(statuschanx); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.AssetId = new SelectList(db.Assets, "ID", "AssetTag", statuschanx.AssetId); ViewBag.StatusId = new SelectList(db.Statuses, "ID", "StatusName", statuschanx.StatusId); return View(statuschanx); }
public ActionResult Edit(StatusChanx statuschanx) { if (ModelState.IsValid) { db.Entry(statuschanx).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.AssetId = new SelectList(db.Assets, "ID", "AssetTag", statuschanx.AssetId); ViewBag.StatusId = new SelectList(db.Statuses, "ID", "StatusName", statuschanx.StatusId); return View(statuschanx); }