public ActionResult AddPhoneNumber()
        {
            ManageModel  manageModel = new ManageModel();
            AccountModel dbModel     = (AccountModel)Session["User"];

            manageModel.PhoneNumber = dbModel.PhoneNumber;
            return(View(manageModel));
        }
        public ActionResult ForgotPassword(ForgotPasswordModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    AccountModel account = SearchAccount(model.EmailAddress);

                    if (account == null)
                    {
                        ViewBag.ErrorMessage = "This email does not have a Maple Building Management account associated with it!";
                        return(View());
                    }

                    var    senderEmail   = new MailAddress("*****@*****.**");
                    var    receiverEmail = new MailAddress(model.EmailAddress);
                    var    password      = "******";
                    string randomString  = RandomString(8, true);
                    var    sub           = "Password reset information for Maple Building Management App";
                    var    body          = "Good day, " + account.FirstName + "!\n\nYour new password for the Maple Building Management App is " + randomString + "\n\nSincerely,\n\nMaple Building Management Admin";
                    var    smtp          = new SmtpClient
                    {
                        Host                  = "smtp.gmail.com",
                        Port                  = 587,
                        EnableSsl             = true,
                        DeliveryMethod        = SmtpDeliveryMethod.Network,
                        UseDefaultCredentials = false,
                        Credentials           = new NetworkCredential(senderEmail.Address, password)
                    };
                    using (var mess = new MailMessage(senderEmail, receiverEmail)
                    {
                        Subject = sub,
                        Body = body
                    })
                    {
                        smtp.Send(mess);
                    }

                    int recordUpdated = UpdatePassword(
                        account.Id,
                        randomString
                        );

                    return(RedirectToAction("SuccessForgotPassword"));
                }
            }
            catch (Exception)
            {
                ViewBag.ErrorMessage = "There seems to be an error with the email messaging system";
            }
            return(View());
        }
        // GET: Manage
        public ActionResult Index()
        {
            if (TempData.ContainsKey("Error"))
            {
                ViewBag.ErrorMessage = TempData["Error"];
            }

            ManageModel  manageModel = new ManageModel();
            AccountModel dbModel     = (AccountModel)Session["User"];

            manageModel.PhoneNumber = dbModel.PhoneNumber;
            manageModel.TwoFactor   = dbModel.TwoFactor;
            return(View(manageModel));
        }