Ejemplo n.º 1
0
        public virtual async Task <IActionResult> SubscriptionActivation(Guid token, bool active)
        {
            var subscription = await _newsLetterSubscriptionService.GetNewsLetterSubscriptionByGuidAsync(token);

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

            if (active)
            {
                subscription.Active = true;
                await _newsLetterSubscriptionService.UpdateNewsLetterSubscriptionAsync(subscription);
            }
            else
            {
                await _newsLetterSubscriptionService.DeleteNewsLetterSubscriptionAsync(subscription);
            }

            var model = await _newsletterModelFactory.PrepareSubscriptionActivationModelAsync(active);

            return(View(model));
        }