Beispiel #1
0
        public async Task <IActionResult> DeleteUser(string UserName)
        {
            var user = await UserManagerAgent.FindByNameAsync(UserName).ConfigureAwait(false);

            if (user != null)
            {
                if (!await UserManagerAgent.IsInRoleAsync(user, _appSettings.SecRole.Admin).ConfigureAwait(false))
                {
                    await UserManagerAgent.DeleteAsync(user).ConfigureAwait(false);
                }
            }

            return(RedirectToAction("Index", "Admin", new { id = "users" }));
        }