public ActionResult Create(Location location) { if (ModelState.IsValid) { db.Locations.Add(location); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.ContainerID = new SelectList(db.Containers, "ContainerID", "ContainerCode", location.ContainerID); return View(location); }
public ActionResult Edit(Location location) { if (ModelState.IsValid) { db.Entry(location).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.ContainerID = new SelectList(db.Containers, "ContainerID", "ContainerCode", location.ContainerID); return View(location); }