public async Task <IActionResult> OnPostDeleteUserFromRoleAsync(string UtenteIdDel, string RuoloIdDel) { Utenti utente = _db.Utenti.Where(u => u.Id.Equals(UtenteIdDel, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault(); Models.Ruoli ruoli = _db.Ruoli.Where(r => r.Id.Equals(RuoloIdDel, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault(); if (await _userManager.IsInRoleAsync(utente, ruoli.Name)) { await _userManager.RemoveFromRoleAsync(utente, ruoli.Name); TempMessageDel = "Role removed from this user successfully !"; } else { TempMessageDel = "This user doesn't belong to selected role."; } return(Page()); }