Exemplo n.º 1
0
        public async Task <IActionResult> Edit()
        {
            User user = await _userManager.FindByNameAsync(User.Identity.Name);

            AccountEditModelView model = new AccountEditModelView(user);

            return(View(model));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(AccountEditModelView model)
        {
            if (ModelState.IsValid)
            {
                User user = await _userManager.FindByNameAsync(User.Identity.Name);

                user.Description = model.Description;
                user.NameSurname = model.NameSurname;
                user.UserName    = model.UserName;
                user.PhoneNumber = model.PhoneNumber;
                user.Email       = model.Email;
                await _emailService.SendEmailAsync(
                    email : user.Email,
                    subject : "Ваши данные были изменены",
                    message : $"<h5>Ваши данные:</h5>{GetUserData(user)}"
                    );

                return(RedirectToAction("Details"));
            }
            return(View(model));
        }