Пример #1
0
        public virtual IActionResult CategoryTemplateDelete(int id)
        {
            //try to get a category template with the specified id
            CategoryTemplate template = _categoryTemplateService.GetCategoryTemplateById(id)
                                        ?? throw new ArgumentException("No template found with the specified id");

            _categoryTemplateService.DeleteCategoryTemplate(template);

            return(new NullJsonResult());
        }
Пример #2
0
        public virtual IActionResult CategoryTemplateDelete(int id)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageMaintenance))
            {
                return(AccessDeniedView());
            }

            //try to get a category template with the specified id
            var template = _categoryTemplateService.GetCategoryTemplateById(id)
                           ?? throw new ArgumentException("No template found with the specified id");

            _categoryTemplateService.DeleteCategoryTemplate(template);

            return(new NullJsonResult());
        }
Пример #3
0
        public async Task <IActionResult> CategoryTemplateDelete(string id)
        {
            var template = await _categoryTemplateService.GetCategoryTemplateById(id);

            if (template == null)
            {
                throw new ArgumentException("No template found with the specified id");
            }
            if (ModelState.IsValid)
            {
                await _categoryTemplateService.DeleteCategoryTemplate(template);

                return(new NullJsonResult());
            }
            return(ErrorForKendoGridJson(ModelState));
        }
Пример #4
0
        public IActionResult CategoryTemplateDelete(string id)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageMaintenance))
            {
                return(AccessDeniedView());
            }

            var template = _categoryTemplateService.GetCategoryTemplateById(id);

            if (template == null)
            {
                throw new ArgumentException("No template found with the specified id");
            }

            _categoryTemplateService.DeleteCategoryTemplate(template);

            return(new NullJsonResult());
        }