Ejemplo n.º 1
0
        public async Task<ActionResult> LoginPageInfo(LoginInfoViewModel model)
        {
            var selectedSite = await siteManager.GetSiteForEdit(model.SiteId);
            // only server admin site can edit other sites settings
            if (selectedSite.Id == siteManager.CurrentSite.Id)
            {
                ViewData["Title"] = sr["Login Page Content"];
            }
            else if (siteManager.CurrentSite.IsServerAdminSite)
            {
                ViewData["Title"] = string.Format(CultureInfo.CurrentUICulture, sr["{0} - Login Page Content"], selectedSite.SiteName);
            }

            if (selectedSite == null)
            {
                this.AlertDanger(sr["oops something went wrong."], true);
                return RedirectToAction("Index");
            }

            if (!ModelState.IsValid)
            {
                return View(model);
            }

            if (model.SiteId == Guid.Empty)
            {
                this.AlertDanger(sr["oops something went wrong, site was not found."], true);
                return RedirectToAction("Index");
            }
            
            selectedSite.LoginInfoTop = model.LoginInfoTop;
            selectedSite.LoginInfoBottom = model.LoginInfoBottom;
            
            await siteManager.Update(selectedSite);
            
            this.AlertSuccess(string.Format(sr["Login Page Info for {0} was successfully updated."],
                        selectedSite.SiteName), true);
            
            if ((siteManager.CurrentSite.IsServerAdminSite)
                && (siteManager.CurrentSite.Id != selectedSite.Id)
                )
            {
                return RedirectToAction("LoginPageInfo", new { siteId = model.SiteId });
            }

            return RedirectToAction("LoginPageInfo");
        }
Ejemplo n.º 2
0
        public async Task<ActionResult> LoginPageInfo(LoginInfoViewModel model)
        {
            ISiteSettings selectedSite = null;
            if (model.SiteGuid == siteManager.CurrentSite.SiteGuid)
            {
                selectedSite = siteManager.CurrentSite;
                ViewData["Title"] = "Login Page Content";
            }
            else if (siteManager.CurrentSite.IsServerAdminSite)
            {
                selectedSite = await siteManager.Fetch(model.SiteGuid);
                ViewData["Title"] = string.Format(CultureInfo.CurrentUICulture, "{0} - Login Page Content", selectedSite.SiteName);
            }

            if (selectedSite == null)
            {
                this.AlertDanger("oops something went wrong.", true);

                return RedirectToAction("Index");
            }

            if (!ModelState.IsValid)
            {
                return View(model);
            }

            if (model.SiteGuid == Guid.Empty)
            {
                this.AlertDanger("oops something went wrong, site was not found.", true);

                return RedirectToAction("Index");
            }

           
            

            selectedSite.LoginInfoTop = model.LoginInfoTop;
            selectedSite.LoginInfoBottom = model.LoginInfoBottom;
            

            bool result = await siteManager.Save(selectedSite);

            if (result)
            {
                this.AlertSuccess(string.Format("Login Page Info for <b>{0}</b> was successfully updated.",
                            selectedSite.SiteName), true);
            }


            if ((siteManager.CurrentSite.IsServerAdminSite)
                && (siteManager.CurrentSite.SiteGuid != selectedSite.SiteGuid)
                )
            {

                return RedirectToAction("LoginPageInfo", new { siteGuid = model.SiteGuid });
            }

            return RedirectToAction("LoginPageInfo");

        }
Ejemplo n.º 3
0
        public async Task<IActionResult> LoginPageInfo(
            Guid? siteId,
            int slp = 1)
        {
            var selectedSite = await siteManager.GetSiteForEdit(siteId);
            // only server admin site can edit other sites settings
            if (selectedSite.Id != siteManager.CurrentSite.Id)
            {
                ViewData["Title"] = string.Format(CultureInfo.CurrentUICulture, sr["{0} - Login Page Content"], selectedSite.SiteName);
            }
            else
            {
                ViewData["Title"] = sr["Login Page Content"];
            }
            
            var model = new LoginInfoViewModel();
            model.SiteId = selectedSite.Id;
            model.LoginInfoTop = selectedSite.LoginInfoTop;
            model.LoginInfoBottom = selectedSite.LoginInfoBottom;

            return View(model);
        }
Ejemplo n.º 4
0
        public async Task<IActionResult> LoginPageInfo(
            Guid? siteGuid,
            int slp = 1)
        {

            ISiteSettings selectedSite;
            // only server admin site can edit other sites settings
            if ((siteGuid.HasValue) && (siteGuid.Value != Guid.Empty) && (siteGuid.Value != siteManager.CurrentSite.SiteGuid) && (siteManager.CurrentSite.IsServerAdminSite))
            {
                selectedSite = await siteManager.Fetch(siteGuid.Value);
                ViewData["Title"] = string.Format(CultureInfo.CurrentUICulture, "{0} - Login Page Content", selectedSite.SiteName);
            }
            else
            {
                selectedSite = siteManager.CurrentSite;
                ViewData["Title"] = "Login Page Content";
            }
            
            LoginInfoViewModel model = new LoginInfoViewModel();
            model.SiteGuid = selectedSite.SiteGuid;
            model.LoginInfoTop = selectedSite.LoginInfoTop;
            model.LoginInfoBottom = selectedSite.LoginInfoBottom;

            return View(model);


        }