public virtual ActionResult TopicTemplateUpdate(TopicTemplateModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageMaintenance)) { return(AccessDeniedView()); } if (!ModelState.IsValid) { return(Json(new DataSourceResult { Errors = ModelState.SerializeErrors() })); } var template = _topicTemplateService.GetTopicTemplateById(model.Id); if (template == null) { throw new ArgumentException("No template found with the specified id"); } template = model.ToEntity(template); _topicTemplateService.UpdateTopicTemplate(template); return(new NullJsonResult()); }
public virtual IActionResult TopicTemplateUpdate(TopicTemplateModel model) { if (!ModelState.IsValid) { return(Json(new DataSourceResult { Errors = ModelState.SerializeErrors() })); } //try to get a topic template with the specified id TopicTemplate template = _topicTemplateService.GetTopicTemplateById(model.Id) ?? throw new ArgumentException("No template found with the specified id"); template = model.ToEntity(template); _topicTemplateService.UpdateTopicTemplate(template); return(new NullJsonResult()); }
public IActionResult TopicTemplateUpdate(TopicTemplateModel model) { if (!ModelState.IsValid) { return(Json(new DataSourceResult { Errors = ModelState.SerializeErrors() })); } var template = _topicTemplateService.GetTopicTemplateById(model.Id); if (template == null) { throw new ArgumentException("No template found with the specified id"); } if (ModelState.IsValid) { template = model.ToEntity(template); _topicTemplateService.UpdateTopicTemplate(template); return(new NullJsonResult()); } return(ErrorForKendoGridJson(ModelState)); }
/// <summary> /// Updates the topic template /// </summary> /// <param name="topicTemplate">Topic template</param> public void UpdateTopicTemplate([FromBody] TopicTemplate topicTemplate) { _topicTemplateService.UpdateTopicTemplate(topicTemplate); }