Ejemplo n.º 1
0
        public ActionResult EditDetails(FormCollection formCollection)
        {
            UserAccounts UserAccounts = new UserAccounts();

            if (UserAccounts.CheckDuplicateEmail(formCollection["Email"].ToString()))
            {
                ModelState.AddModelError(String.Empty, "Email is already in use");
                return(View());
            }
            else
            {
                var       Name     = HttpContext.User.Identity.Name;
                UserModel EditUser = new UserModel();
                EditUser.FirstName = formCollection["FirstName"].ToString();
                EditUser.LastName  = formCollection["LastName"].ToString();
                EditUser.Email     = formCollection["Email"].ToString();
                UserAccounts.EditUserInformation(Name, EditUser);
                TempData["Success"] = "Details have been saved!";
                return(RedirectToAction("EditDetails", "Account", new { userName = Name }));
            }
        }