public ActionResult PostTemplateUpdate(PostTemplateModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageMaintenance)) { return(AccessDeniedView()); } if (!ModelState.IsValid) { return(Json(new DataSourceResult { Errors = ModelState.SerializeErrors() })); } var template = _postTemplateService.GetPostTemplateById(model.Id); if (template == null) { throw new ArgumentException("No template found with the specified id"); } template = model.ToEntity(template); _postTemplateService.UpdatePostTemplate(template); return(new NullJsonResult()); }
public ActionResult PostTemplateAdd([Bind(Exclude = "Id")] PostTemplateModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageMaintenance)) { return(AccessDeniedView()); } if (!ModelState.IsValid) { return(Json(new DataSourceResult { Errors = ModelState.SerializeErrors() })); } var template = new PostTemplate(); template = model.ToEntity(template); _postTemplateService.InsertPostTemplate(template); return(new NullJsonResult()); }