Exemplo n.º 1
0
        public ActionResult MagnamentActiveSite()
        {
            var sites = SitesManager.GetSites();
            var model = new CastleClub.BackEnd.Models.MagnementActivesSitesVM()
            {
                MasterEmailFormProcentage   = sites[0].MasterCardEmailFormPercentage,
                VisaEmailFormPorcentage     = sites[0].VisaEmailFormPercentage,
                DiscoverEmailFormPorcentage = sites[0].DiscoverEmailFormPercentage
            };

            model.Sites = new List <MagnementActiveSiteVM>();
            foreach (var site in sites.OrderBy(x => x.Id))
            {
                var siteRepeat = model.Sites.FirstOrDefault(x => x.Site.Name == site.Name);
                if (siteRepeat != null)
                {
                    model.Sites.Remove(siteRepeat);
                }
                model.Sites.Add(new CastleClub.BackEnd.Models.MagnementActiveSiteVM()
                {
                    Active = site.Active,
                    SiteId = site.Id,
                    Site   = site,
                    Url    = (site.OfferDomain.Contains("https://www.")) ?
                             site.SignupDomain
                            : "https://www." + site.SignupDomain.Replace("www", string.Empty).Replace("http://", string.Empty).Replace("https://", string.Empty) + "/optin.aspx"
                });
            }

            model.Sites = model.Sites.OrderBy(x => x.Site.Name).ToList();

            return(View(model));
        }
Exemplo n.º 2
0
        public bool MagnamentActiveSite(CastleClub.BackEnd.Models.MagnementActivesSitesVM model)
        {
            if (!ModelState.IsValid)
            {
                return(false);
            }

            if (model.SiteID > 0)
            {
                return(SitesManager.SetActiveSite(model.SiteID));
            }

            return(false);
        }