Exemplo n.º 1
0
        public ActionResult ChangeEmail(ChangeEmailViewModel model)
        {
            if (ModelState.IsValid)
            {
                var email = accountDAL.FetchByEmail(model.email);
                if (email == null)
                {
                    _email.SendChangedEmailVerificationEmail(model.email, model.email);
                    TempData["successMessage"] = "A confirmation has been sent to your email. Your email will be changed once you follow the link in your email";
                    return(RedirectToAction("ChangeEmail", "Account"));
                }

                else if (email != null)
                {
                    TempData["errorMessage"] = "That email already exists in the system";
                    return(RedirectToAction("ChangeEmail", "Account"));
                }
            }

            return(View(model));
        }