public ActionResult DeleteConfirmed(int id) { ManagesBranch managesBranch = db.ManagesBranch.Where(assigned => (assigned.managerId == id)).FirstOrDefault(); db.ManagesBranch.Remove(managesBranch); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "managerId,startDate,branchId")] ManagesBranch managesBranch) { if (ModelState.IsValid) { db.Entry(managesBranch).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.branchId = new SelectList(db.Branch, "id", "branchName", managesBranch.branchId); ViewBag.managerId = new SelectList(db.Employee, "id", "firstName", managesBranch.managerId); return(View(managesBranch)); }
// GET: ManagesBranches/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ManagesBranch managesBranch = db.ManagesBranch.Where(assigned => (assigned.managerId == id)).FirstOrDefault(); if (managesBranch == null) { return(HttpNotFound()); } return(View(managesBranch)); }
// GET: ManagesBranches/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ManagesBranch managesBranch = db.ManagesBranch.Where(assigned => (assigned.managerId == id)).FirstOrDefault();; if (managesBranch == null) { return(HttpNotFound()); } ViewBag.branchId = new SelectList(db.Branch, "id", "branchName", managesBranch.branchId); ViewBag.managerId = new SelectList(db.Employee, "id", "firstName", managesBranch.managerId); return(View(managesBranch)); }