public ActionResult Create(int?returnTo, RelatedNumberBLL relatednumber) { try { using (BLLContext ctx = new BLLContext()) { ctx.RelatedNumbers.InsertNewRelatedNumber(relatednumber.RelatedName, relatednumber.RelatedLanguage, relatednumber.ParentNumberID); } if (returnTo.HasValue & returnTo.Value >= 0) { return(RedirectToAction("ViewRelated", "Number", new { id = returnTo })); } else { return(RedirectToAction("Index")); } } catch (Exception ex) { return(View("exception", ex)); } }
public ActionResult Edit(int?returnTo, int id, RelatedNumberBLL relatednumber) { try { using (BLLContext ctx = new BLLContext()) { ctx.RelatedNumbers.PessimisticUpdateOfRelatedNumber(relatednumber); if (returnTo.HasValue & returnTo.Value >= 0) { return(RedirectToAction("ViewRelated", "Number", new { id = returnTo })); } else { return(RedirectToAction("Index")); } } } catch (Exception ex) { return(View("exception", ex)); } }
public ActionResult Delete(int?returnTo, int id, RelatedNumberBLL relatednumber) { try { // TODO: Add delete logic here using (BLLContext ctx = new BLLContext()) { ctx.RelatedNumbers.JustDeleteARelatedNumber(id); if (returnTo.HasValue & returnTo.Value >= 0) { return(RedirectToAction("ViewRelated", "Number", new { id = returnTo })); } else { return(RedirectToAction("Index")); } } } catch (Exception ex) { return(View("exception", ex)); } }