public ActionResult DeleteConfirmed(int id) { SalesRep salesRep = db.SalesReps.Find(id); db.SalesReps.Remove(salesRep); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,name,userID,managerID")] SalesRep salesRep) { if (ModelState.IsValid) { db.Entry(salesRep).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.managerID = new SelectList(db.Managers, "Id", "Id", salesRep.managerID); return(View(salesRep)); }
public ActionResult Create([Bind(Include = "Id,name,userID,managerID")] SalesRep salesRep) { if (ModelState.IsValid) { db.SalesReps.Add(salesRep); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.managerID = new SelectList(db.Managers, "Id", "Id", salesRep.managerID); return(View(salesRep)); }
// GET: SalesReps/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SalesRep salesRep = db.SalesReps.Find(id); if (salesRep == null) { return(HttpNotFound()); } return(View(salesRep)); }
// GET: SalesReps/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SalesRep salesRep = db.SalesReps.Find(id); if (salesRep == null) { return(HttpNotFound()); } ViewBag.managerID = new SelectList(db.Managers, "Id", "Id", salesRep.managerID); return(View(salesRep)); }