Esempio n. 1
0
        private static void RemoveExistingUserRoles(string userId, AdminAppIdentityDbContext dbContext)
        {
            var existingUserRoles =
                dbContext.Set <IdentityUserRole>().Where(x => x.UserId == userId);

            if (existingUserRoles.Any())
            {
                dbContext.Set <IdentityUserRole>().RemoveRange(existingUserRoles);
            }

            dbContext.SaveChanges();
        }