Пример #1
0
        public async Task <IViewComponentResult> InvokeAsync(string siteId = "", string pageMasterId = "")
        {
            PageMasterViewModel model = null;

            if (string.IsNullOrEmpty(pageMasterId))
            {
                model = new PageMasterViewModel {
                    SiteId = siteId
                };
            }
            else
            {
                var pageMaster = await _pageMasterManager.GetByIdAsync(pageMasterId);

                model = pageMaster.ProjectTo <PageMasterViewModel>();
            }

            var dropDownData = _siteContext.Template.PageTemplates;

            foreach (var item in dropDownData)
            {
                model.ViewTemplates.Add(new SelectListItem()
                {
                    Value = item.Id, Text = item.Title
                });
            }

            return(View(model));
        }
Пример #2
0
        public async Task <IActionResult> GetVersions(string id)
        {
            var user       = _userContextAccessor.GetContext();
            var masterPage = await _masterPageManager.GetByIdAsync(id);

            if (!_pageSecurity.CanDesignMaster(user, masterPage))
            {
                return(this.Unauthorized());
            }

            var versions = await _masterPageManager.GetVersions(id);

            ViewData["VersionDialogTitle"] = "Master Page Designer - Version Selector";

            ViewData["VersionPreviewRoute"] = $"/sys/master/{id}/preview";
            ViewData["VersionDesignRoute"]  = $"/sys/master/{id}/design";
            ViewData["VersionCreateRoute"]  = $"/sys/master/{id}/versions";


            return(PartialView("/UI/Views/Public/SitePage/VersionsModal.cshtml", versions));
        }
Пример #3
0
        public async Task <JsonResult> GetById(string Id)
        {
            var masterPage = await _pageMasterManager.GetByIdAsync(Id);

            return(Json(masterPage));
        }