Esempio n. 1
0
        public async Task <SubscriptionActivationModel> Handle(SubscriptionActivationCommand request, CancellationToken cancellationToken)
        {
            var subscription = await _newsLetterSubscriptionService.GetNewsLetterSubscriptionByGuid(request.Token);

            if (subscription == null)
            {
                return(null);
            }

            var model = new SubscriptionActivationModel();

            if (request.Active)
            {
                subscription.Active = true;
                await _newsLetterSubscriptionService.UpdateNewsLetterSubscription(subscription);
            }
            else
            {
                await _newsLetterSubscriptionService.DeleteNewsLetterSubscription(subscription);
            }

            model.Result = request.Active
                ? _translationService.GetResource("Newsletter.ResultActivated")
                : _translationService.GetResource("Newsletter.ResultDeactivated");

            return(model);
        }
Esempio n. 2
0
        public ActionResult SubscriptionActivation(Guid token, bool active)
        {
            var subscription = _newsLetterSubscriptionService.GetNewsLetterSubscriptionByGuid(token);

            if (subscription == null)
            {
                return(RedirectToRoute("HomePage"));
            }

            var model = new SubscriptionActivationModel();

            if (active)
            {
                subscription.Active = active;
                _newsLetterSubscriptionService.UpdateNewsLetterSubscription(subscription);
            }
            else
            {
                _newsLetterSubscriptionService.DeleteNewsLetterSubscription(subscription);
            }

            if (active)
            {
                model.Result = _localizationService.GetResource("Newsletter.ResultActivated");
            }
            else
            {
                model.Result = _localizationService.GetResource("Newsletter.ResultDeactivated");
            }

            return(View(model));
        }
Esempio n. 3
0
        public ActionResult SubscriptionActivation(Guid token, bool active)
        {
            var subscription = _newsLetterSubscriptionService.GetNewsLetterSubscriptionByGuid(token);

            if (subscription == null)
            {
                return(HttpNotFound());
            }

            var model = new SubscriptionActivationModel();

            if (active)
            {
                subscription.Active = active;
                _newsLetterSubscriptionService.UpdateNewsLetterSubscription(subscription);
            }
            else
            {
                _newsLetterSubscriptionService.DeleteNewsLetterSubscription(subscription);
            }

            model.Result = T(active ? "Newsletter.ResultActivated" : "Newsletter.ResultDeactivated");

            return(View(model));
        }
        public virtual async Task <IActionResult> SubscriptionActivation(Guid token, bool active)
        {
            var subscription = await _newsLetterSubscriptionService.GetNewsLetterSubscriptionByGuid(token);

            if (subscription == null)
            {
                return(RedirectToRoute("HomePage"));
            }

            var model = await _newsletterViewModelService.PrepareSubscriptionActivation(subscription, active);

            return(View(model));
        }
Esempio n. 5
0
        public ActionResult SubscriptionActivation(Guid token, bool active)
        {
            var subscription = _newsLetterSubscriptionService.GetNewsLetterSubscriptionByGuid(token);

            if (subscription == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            var model = new SubscriptionActivationModel();

            if (active)
            {
                subscription.Active = active;
                _newsLetterSubscriptionService.UpdateNewsLetterSubscription(subscription);

                if (subscription.RegistrationType == "promoted5")
                {
                    StatefulStorage.PerSession.Add <Guid>("newslettersubscriptiontoken", () => token);
                    return(RedirectToAction("NewsletterPromotedDynasty"));
                }
            }
            else
            {
                _newsLetterSubscriptionService.DeleteNewsLetterSubscription(subscription);
            }

            if (active)
            {
                model.Result = _localizationService.GetResource("Newsletter.ResultActivated");
            }
            else
            {
                model.Result = _localizationService.GetResource("Newsletter.ResultDeactivated");
            }

            return(View(model));
        }
Esempio n. 6
0
        public virtual ActionResult SubscriptionActivation(Guid token, bool active)
        {
            var subscription = _newsLetterSubscriptionService.GetNewsLetterSubscriptionByGuid(token);

            if (subscription == null)
            {
                return(RedirectToRoute("HomePage"));
            }

            if (active)
            {
                subscription.Active = true;
                _newsLetterSubscriptionService.UpdateNewsLetterSubscription(subscription);
            }
            else
            {
                _newsLetterSubscriptionService.DeleteNewsLetterSubscription(subscription);
            }

            var model = _newsletterModelFactory.PrepareSubscriptionActivationModel(active);

            return(View(model));
        }
        public virtual Models.Newsletter.SubscriptionActivationModel SubscriptionActivation(Guid token, bool active)
        {
            var subscription = _newsLetterSubscriptionService.GetNewsLetterSubscriptionByGuid(token);

            if (subscription == null)
            {
                return(null);
            }

            if (active)
            {
                subscription.Active = true;
                _newsLetterSubscriptionService.UpdateNewsLetterSubscription(subscription);
            }
            else
            {
                _newsLetterSubscriptionService.DeleteNewsLetterSubscription(subscription);
            }

            var model = _newsletterModelFactory.PrepareSubscriptionActivationModel(active);

            return(model);
        }
Esempio n. 8
0
 /// <summary>
 /// Gets a newsletter subscription by newsletter subscription GUID
 /// </summary>
 /// <param name="newsLetterSubscriptionGuid">The newsletter subscription GUID</param>
 /// <returns>NewsLetter subscription</returns>
 public NewsLetterSubscription GetNewsLetterSubscriptionByGuid(Guid newsLetterSubscriptionGuid)
 {
     return(_newsLetterSubscriptionService.GetNewsLetterSubscriptionByGuid(newsLetterSubscriptionGuid));
 }