public async Task <IActionResult> PageLayoutAdd(PageLayoutModel model) { if (!ModelState.IsValid) { return(Json(new DataSourceResult { Errors = ModelState.SerializeErrors() })); } if (ModelState.IsValid) { var layout = new PageLayout(); layout = model.ToEntity(layout); await _pageLayoutService.InsertPageLayout(layout); return(new JsonResult("")); } return(ErrorForKendoGridJson(ModelState)); }
public async Task <IActionResult> PageLayoutUpdate(PageLayoutModel model) { if (!ModelState.IsValid) { return(Json(new DataSourceResult { Errors = ModelState.SerializeErrors() })); } var layout = await _pageLayoutService.GetPageLayoutById(model.Id); if (layout == null) { throw new ArgumentException("No template found with the specified id"); } if (ModelState.IsValid) { layout = model.ToEntity(layout); await _pageLayoutService.UpdatePageLayout(layout); return(new JsonResult("")); } return(ErrorForKendoGridJson(ModelState)); }