Beispiel #1
0
        public async Task <IActionResult> Edit(ChangeUserRoleViewModel model)
        {
            if (model == null)
            {
                return(NotFound());
            }

            var user = await _userHelper.GetUserByIdAsync(model.UserId);

            if (ModelState.IsValid)
            {
                await _userHelper.UpdateUserAsync(user);

                await _userHelper.ChangeUserRoleAsync(user, User.Identity.Name, model.RoleName);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(model));
        }