コード例 #1
0
        public async Task <string> Handle(GetPageLayoutViewPath request, CancellationToken cancellationToken)
        {
            var layout = await _pageLayoutService.GetPageLayoutById(request.LayoutId);

            if (layout == null)
            {
                layout = (await _pageLayoutService.GetAllPageLayouts()).FirstOrDefault();
            }
            if (layout == null)
            {
                throw new Exception("No default layout could be loaded");
            }
            return(layout.ViewPath);
        }
コード例 #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));
        }