예제 #1
0
        public ActionResult AccountChangePhoneEmail(AccountChangePhoneEmailViewModel model)
        {
            if (!IsLoggedIn())
            {
                return(RedirectToAction("Index", "Home"));
            }

            if (!ModelState.IsValid)
            {
                return(View());
            }

            var dbEntry        = _accountRepository.GetById(new Guid(model.Id));
            var updatedAccount = new Account
            {
                Id           = dbEntry.Id,
                Firstname    = dbEntry.Firstname,
                Lastname     = dbEntry.Lastname,
                Phonenumber  = model.Phonenumber,
                Email        = model.Email,
                GroupChats   = dbEntry.GroupChats,
                PrivateChats = dbEntry.PrivateChats,
                Password     = dbEntry.Password
            };

            _accountRepository.Update(updatedAccount);

            LogOut();
            return(RedirectToAction("Index", "Home"));
        }
예제 #2
0
        public ActionResult AccountChangePhoneEmail()
        {
            if (!IsLoggedIn())
            {
                return(RedirectToAction("Index", "Home"));
            }
            var account = (Account)Session["Loggedin_Account"];

            var email = account.Email;

            var dbAccountEntry = _accountRepository.FirstOrDefault(a => a.Email == email);

            var accountChangePhoneEmailViewModel = new AccountChangePhoneEmailViewModel();

            accountChangePhoneEmailViewModel.Email       = dbAccountEntry.Email;
            accountChangePhoneEmailViewModel.Phonenumber = dbAccountEntry.Phonenumber;

            return(View(accountChangePhoneEmailViewModel));
        }