public ActionResult DeleteConfirmed(int id) { Otdely otdely = db.Otdely.Find(id); db.Otdely.Remove(otdely); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "id_otd,name_otd,id_otd_parent,date_birth,date_death,id_nach")] Otdely otdely) { if (ModelState.IsValid) { db.Entry(otdely).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.id_nach = new SelectList(db.Sotrudniki, "id_sotr", "name_sotr", otdely.id_nach); return(View(otdely)); }
// GET: Otdely/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Otdely otdely = db.Otdely.Find(id); if (otdely == null) { return(HttpNotFound()); } return(View(otdely)); }
// GET: Otdely/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Otdely otdely = db.Otdely.Find(id); if (otdely == null) { return(HttpNotFound()); } ViewBag.id_nach = new SelectList(db.Sotrudniki, "id_sotr", "name_sotr", otdely.id_nach); return(View(otdely)); }