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