示例#1
0
        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));
            }
        }
示例#2
0
        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));
            }
        }
示例#3
0
        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));
            }
        }