Example #1
0
        public ActionResult Index(UnsubscribeFormViewModel viewModel)
        {
            if (this.ModelState.IsValid && this.Model.ListId != Guid.Empty)
            {
                string error;
                bool   isSucceeded = this.Model.Unsubscribe(viewModel, out error);

                this.ViewBag.Error      = error;
                this.ViewBag.IsSucceded = isSucceeded;

                if (isSucceeded)
                {
                    var redirectUrl = viewModel.RedirectPageUrl;
                    var validator   = ObjectFactory.Resolve <IRedirectUriValidator>();
                    if (this.Model.SuccessfullySubmittedForm == SuccessfullySubmittedForm.OpenSpecificPage && !string.IsNullOrEmpty(viewModel.RedirectPageUrl) && validator.IsValid(redirectUrl))
                    {
                        return(this.Redirect(viewModel.RedirectPageUrl));
                    }

                    this.ModelState.Clear();
                }
            }

            viewModel = this.Model.CreateViewModel();

            var fullTemplateName = this.emailAddressTemplateNamePrefix + this.EmailAddressTemplateName;

            return(this.View(fullTemplateName, viewModel));
        }
 public bool Unsubscribe(UnsubscribeFormViewModel viewModel, out string error)
 {
     error = string.Empty;
     return(true);
 }