Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
        }