public async Task <IActionResult> SetNick(ChangeNickViewModel model) { if (!ModelState.IsValid) { return(View(model)); } ApplicationUser appUser = await _userManager.GetUserAsync(HttpContext.User); User user = _repository.GetUser(Guid.Parse(appUser.Id)); _repository.SetNick(model.Nick, user.Id, user.ActiveGroup.Id); return(Redirect("Index")); }
public async Task <IActionResult> SetNick() { ApplicationUser appUser = await _userManager.GetUserAsync(HttpContext.User); User user = _repository.GetUser(Guid.Parse(appUser.Id)); if (user.ActiveGroup == null) { return(Forbid()); } ChangeNickViewModel model = new ChangeNickViewModel() { Nick = _repository.GetNick(user.Id, user.ActiveGroup.Id) }; return(View(model)); }