Пример #1
0
        public ActionResult DeleteController(int cID, string returnURL, bool submitted = false)
        {
            ModelState.Clear();
            if(submitted)
            {
                try
                {
                    repositorie.DeleteController(cID, uRepositorie.Users.SingleOrDefault(u => u.Name == System.Web.HttpContext.Current.User.Identity.Name).Name);
                }
                catch (Exception e)
                {
                    ModelState.AddModelError("1", e.Message);
                }
            }

            if (ModelState.IsValid)
            {
                return Redirect(returnURL);
            }
            else
            {
                DeleteController_VM model = new DeleteController_VM
                {
                    Controller = repositorie.Controllers.SingleOrDefault(c => c.C_ID == cID),
                    ReturnUrl = returnURL
                };

                return View(model);
            }
        }
Пример #2
0
        public ActionResult DeleteController(int cID, string returnURL)
        {
            DeleteController_VM model = new DeleteController_VM
            {
                Controller = repositorie.Controllers.SingleOrDefault(c => c.C_ID == cID),
                ReturnUrl = returnURL
            };

            return View (model);
        }