public ActionResult DeleteConfirmed(int id) { Brigades brigades = db.Brigades.Find(id); db.Brigades.Remove(brigades); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "BrigadeId,DepartmentId,BrigadeName")] Brigades brigades) { if (ModelState.IsValid) { db.Entry(brigades).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.DepartmentId = new SelectList(db.Departments, "DepartmentId", "DepartmentName", brigades.DepartmentId); return(View(brigades)); }
public ActionResult Create([Bind(Include = "BrigadeId,DepartmentId,BrigadeName")] Brigades brigades) { if (ModelState.IsValid) { db.Brigades.Add(brigades); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.DepartmentId = new SelectList(db.Departments, "DepartmentId", "DepartmentName", brigades.DepartmentId); return(View(brigades)); }
// GET: Brigades/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Brigades brigades = db.Brigades.Find(id); if (brigades == null) { return(HttpNotFound()); } return(View(brigades)); }
// GET: Brigades/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Brigades brigades = db.Brigades.Find(id); if (brigades == null) { return(HttpNotFound()); } ViewBag.DepartmentId = new SelectList(db.Departments, "DepartmentId", "DepartmentName", brigades.DepartmentId); return(View(brigades)); }