// // GET: /Depots/Edit/5 public ActionResult Edit(int id) { DEPOT depot = db.DEPOTS.Single(d => d.ID == id); ViewBag.REGION_ID = new SelectList(db.REGIONS, "ID", "NAME", depot.REGION_ID); return(View(depot)); }
public ActionResult DeleteConfirmed(int id) { DEPOT depot = db.DEPOTS.Single(d => d.ID == id); db.DEPOTS.DeleteObject(depot); db.SaveChanges(); return(RedirectToAction("Index")); }
// // GET: /Depots/Details/5 public ViewResult Details(int id) { DEPOT depot = db.DEPOTS.Single(d => d.ID == id); var boss = db.EMPLOYEES.Where(m => m.DEPOT_ID == depot.ID).FirstOrDefault(); Session["depot_id"] = depot.ID; ViewBag.boss = boss; return(View(depot)); }
public ActionResult Create(DEPOT depot) { if (ModelState.IsValid) { db.DEPOTS.AddObject(depot); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.REGION_ID = new SelectList(db.REGIONS, "ID", "NAME", depot.REGION_ID); return View(depot); }
public ActionResult Edit(DEPOT depot) { if (ModelState.IsValid) { db.DEPOTS.Attach(depot); db.ObjectStateManager.ChangeObjectState(depot, EntityState.Modified); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.REGION_ID = new SelectList(db.REGIONS, "ID", "NAME", depot.REGION_ID); return(View(depot)); }
public ActionResult Create(DEPOT depot) { if (ModelState.IsValid) { db.DEPOTS.AddObject(depot); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.REGION_ID = new SelectList(db.REGIONS, "ID", "NAME", depot.REGION_ID); return(View(depot)); }
public ActionResult Edit(DEPOT depot) { if (ModelState.IsValid) { db.DEPOTS.Attach(depot); db.ObjectStateManager.ChangeObjectState(depot, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.REGION_ID = new SelectList(db.REGIONS, "ID", "NAME", depot.REGION_ID); return View(depot); }
// // GET: /Depots/Delete/5 public ActionResult Delete(int id) { DEPOT depot = db.DEPOTS.Single(d => d.ID == id); return(View(depot)); }