Ejemplo n.º 1
0
        public ActionResult DeleteRule(DeleteConfirmationModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View("~/Views/Shared/Dialogs/DeleteConfirmation.cshtml", model));
            }
            var repository = CurrentAccountDbContext.GetHttpRequestUnitTestRuleRepository();
            var rule       = repository.GetById(Guid.Parse(model.Id));

            CheckRuleDeletingPermissions(rule);
            var unitTestId = rule.HttpRequestUnitTestId;

            repository.Remove(rule);
            this.SetTempMessage(TempMessageType.Success, "Правило проверки удалёно");
            return(RedirectToAction("Edit", new { id = unitTestId }));
        }
Ejemplo n.º 2
0
        public ActionResult DeleteRule(Guid id)
        {
            var repository = CurrentAccountDbContext.GetHttpRequestUnitTestRuleRepository();
            var rule       = repository.GetById(id);

            CheckRuleDeletingPermissions(rule);
            var model = new DeleteConfirmationModel()
            {
                Id        = id.ToString(),
                Title     = "Удаление правила проверки",
                ModalMode = Request.IsAjaxRequest(),
                Message   = "Вы действительно хотите удалить это правило?",
                ReturnUrl = Url.Action("Edit", new { id = rule.HttpRequestUnitTestId })
            };

            return(View("~/Views/Shared/Dialogs/DeleteConfirmation.cshtml", model));
        }