public virtual ActionResult ArticleTemplateUpdate(ArticleTemplateModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageMaintenance)) { return(AccessDeniedView()); } if (!ModelState.IsValid) { return(Json(new DataSourceResult { Errors = ModelState.SerializeErrors() })); } var template = _articleTemplateService.GetArticleTemplateById(model.Id); if (template == null) { throw new ArgumentException("No template found with the specified id"); } template = model.ToEntity(template); _articleTemplateService.UpdateArticleTemplate(template); return(new NullJsonResult()); }
public virtual ActionResult ArticleTemplateAdd([Bind(Exclude = "Id")] ArticleTemplateModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageMaintenance)) { return(AccessDeniedView()); } if (!ModelState.IsValid) { return(Json(new DataSourceResult { Errors = ModelState.SerializeErrors() })); } var template = new ArticleTemplate(); template = model.ToEntity(template); _articleTemplateService.InsertArticleTemplate(template); return(new NullJsonResult()); }
public static ArticleTemplate ToEntity(this ArticleTemplateModel model, ArticleTemplate destination) { return(model.MapTo(destination)); }
public static ArticleTemplate ToEntity(this ArticleTemplateModel model) { return(model.MapTo <ArticleTemplateModel, ArticleTemplate>()); }