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()); }
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()); }
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)); }
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()); }