public ActionResult Edit(int ID) { OfficeService service = new OfficeService(); var office = service.Getbykey(ID); return(View(office)); }
public ActionResult Delete(int ID) { OfficeService service = new OfficeService(); try { if (ID < 0) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var office = service.Getbykey(ID); if (office == null) { return(HttpNotFound()); } service.Delete(office.OfficeID); return(RedirectToAction("Index")); } catch (Exception ex) { return(View("Error")); } }