예제 #1
0
        public async Task <ActionResult> NewPageTemplate(string tabId, int parentId)
        {
            var template = _pageTemplateService.NewPageTemplateProperties(parentId);
            var model    = PageTemplateViewModel.Create(template, tabId, parentId, _pageTemplateService);

            return(await JsonHtml("Properties", model));
        }
예제 #2
0
        public async Task <ActionResult> PageTemplateProperties(string tabId, int parentId, int id, string successfulActionCode)
        {
            var template = _pageTemplateService.ReadPageTemplateProperties(id);

            ViewData[SpecialKeys.IsEntityReadOnly] = template.LockedByAnyoneElse;
            var model = PageTemplateViewModel.Create(template, tabId, parentId, _pageTemplateService);

            model.SuccesfulActionCode = successfulActionCode;
            return(await JsonHtml("Properties", model));
        }
예제 #3
0
        public async Task <ActionResult> PageTemplateProperties(string tabId, int parentId, int id, IFormCollection collection)
        {
            var template = _pageTemplateService.ReadPageTemplatePropertiesForUpdate(id);
            var model    = PageTemplateViewModel.Create(template, tabId, parentId, _pageTemplateService);

            await TryUpdateModelAsync(model);

            if (ModelState.IsValid)
            {
                model.Data = _pageTemplateService.UpdatePageTemplateProperties(model.Data);
                return(Redirect("PageTemplateProperties", new { tabId, parentId, id = model.Data.Id, successfulActionCode = ActionCode.UpdatePageTemplate }));
            }

            return(await JsonHtml("Properties", model));
        }
예제 #4
0
        public ActionResult NewPageTemplate(string tabId, int parentId, FormCollection collection)
        {
            var template = _pageTemplateService.NewPageTemplatePropertiesForUpdate(parentId);
            var model    = PageTemplateViewModel.Create(template, tabId, parentId, _pageTemplateService);

            TryUpdateModel(model);
            model.Validate(ModelState);
            if (ModelState.IsValid)
            {
                model.Data = _pageTemplateService.SavePageTemplateProperties(model.Data);
                PersistResultId(model.Data.Id);
                return(Redirect("PageTemplateProperties", new { tabId, parentId, id = model.Data.Id, successfulActionCode = ActionCode.SavePageTemplate }));
            }

            return(JsonHtml("Properties", model));
        }