Exemplo n.º 1
0
        public async Task<ActionResult> Edit(EditModel model)
        {
            ApplicationUser user = await UserManager.FindByEmailAsync(User.Identity.Name);
            if (user != null)
            {
                user.Year = model.Year;
                IdentityResult result = await UserManager.UpdateAsync(user);
                if (result.Succeeded)
                {
                    return RedirectToAction("LIst", "Game");
                }
                else
                {
                    ModelState.AddModelError("", "Что-то пошло не так");
                }
            }
            else
            {
                ModelState.AddModelError("", "Пользователь не найден");
            }

            return View(model);
        }
Exemplo n.º 2
0
 public async Task<ActionResult> Edit()
 {
     ApplicationUser user = await UserManager.FindByEmailAsync(User.Identity.Name);
     if (user != null)
     {
         EditModel model = new EditModel { Year = user.Year };
         return View(model);
     }
     return RedirectToAction("Login", "Account");
 }