/// <returns>A task that represents the asynchronous operation</returns> public virtual async Task <IActionResult> CategoryTemplateUpdate(CategoryTemplateModel model) { if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageMaintenance)) { return(AccessDeniedView()); } if (!ModelState.IsValid) { return(ErrorJson(ModelState.SerializeErrors())); } //try to get a category template with the specified id var template = await _categoryTemplateService.GetCategoryTemplateByIdAsync(model.Id) ?? throw new ArgumentException("No template found with the specified id"); template = model.ToEntity(template); await _categoryTemplateService.UpdateCategoryTemplateAsync(template); return(new NullJsonResult()); }