public ActionResult Update(PersonalDocument entity) { try { var repo = new DocumentRepository(); repo.Update(entity); return View("index"); } catch (ArgumentException e) { //ViewBag.ErrorMsg = "You have enteres some invalid data!"; ViewBag.ErrorMsg = "You have enteres some invalid data! \n" + e.StackTrace; return this.View("Add", entity); } }
public ActionResult Create(PersonalDocument entity) { try { var repo = new DocumentRepository(); repo.Add(entity); return this.RedirectToAction("Index", "Home"); } catch (ArgumentException e) { ViewBag.ErrorMsg = "You have enteres some invalid data! \n" + e.StackTrace; return this.View("Add", entity); } catch (Exception e) { ViewBag.ErrorMsg = "You have enteres some invalid data! \n" + e.StackTrace; return this.View("Add", entity); } }
public ActionResult Delete(int id) { var repo = new DocumentRepository(); repo.Delete(id); return this.RedirectToAction("Index", "Home"); }
public ActionResult RedirectToUpdate(int id) { var repo = new DocumentRepository(); var entity = repo.GetById(id); return View("Add", entity); }
public ActionResult Details(int id) { var repo = new DocumentRepository(); var entity = repo.GetById(id); return View(entity); }
public ActionResult Index() { var repo = new DocumentRepository(); var results = repo.GetAll(); return View(results); }