Exemple #1
0
        public async Task <ActionResult> New(string tabId, int parentId)
        {
            var site  = SiteService.New();
            var model = SiteViewModel.Create(site, tabId, parentId);

            return(await JsonHtml("Properties", model));
        }
Exemple #2
0
        public async Task <ActionResult> Properties(string tabId, int parentId, int id, string successfulActionCode)
        {
            var site = SiteService.Read(id);

            ViewData[SpecialKeys.IsEntityReadOnly] = site.LockedByAnyoneElse;
            var model = SiteViewModel.Create(site, tabId, parentId);

            model.SuccesfulActionCode = successfulActionCode;
            return(await JsonHtml("Properties", model));
        }
Exemple #3
0
        public async Task <ActionResult> Properties(string tabId, int parentId, int id, IFormCollection collection)
        {
            var site  = SiteService.ReadForUpdate(id);
            var model = SiteViewModel.Create(site, tabId, parentId);

            await TryUpdateModelAsync(model);

            if (ModelState.IsValid)
            {
                model.Data = SiteService.Update(model.Data, model.ActiveVeCommandsIds, model.ActiveVeStyleIds);
                return(Redirect("Properties", new { tabId, parentId, id = model.Data.Id, successfulActionCode = ActionCode.UpdateSite }));
            }

            return(await JsonHtml("Properties", model));
        }
Exemple #4
0
        public ActionResult New(string tabId, int parentId, FormCollection collection)
        {
            var site  = SiteService.NewForSave();
            var model = SiteViewModel.Create(site, tabId, parentId);

            TryUpdateModel(model);
            model.Validate(ModelState);
            if (ModelState.IsValid)
            {
                model.Data = SiteService.Save(model.Data, model.ActiveVeCommandsIds, model.ActiveVeStyleIds);
                PersistResultId(model.Data.Id);
                return(Redirect("Properties", new { tabId, parentId, id = model.Data.Id, successfulActionCode = ActionCode.SaveSite }));
            }

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