public static bool AddUserToGroupSuit(ApplicationGroup group, string userId)
 {
     AddUserToGroup(group, userId);
     ApplicationUserProvider.removeRolesFromUser(userId);
     ApplicationUserProvider.AssignRolesToUser(userId, ApplicationRoleProvider.GetLogicRolesByUserId(userId));
     return(true);
 }
 public static bool AddUserToGroupsSuit(IEnumerable <ApplicationGroup> groups, string userId)
 {
     AddUserToGroups(groups, userId);
     ApplicationUserProvider.removeRolesFromUser(userId);
     ApplicationUserProvider.AssignRolesToUser(userId, ApplicationRoleProvider.GetLogicRolesByUserId(userId));
     return(true);
 }
 public static bool AddUserToGroupSuitTransaction(ApplicationGroup group, string userId)
 {
     using (DbContextTransaction transaction = RepositoryBase <ApplicationGroup> .DbContext.Database.BeginTransaction())
     {
         try
         {
             AddUserToGroup(group, userId);
             ApplicationUserProvider.removeRolesFromUser(userId);
             ApplicationUserProvider.AssignRolesToUser(userId, ApplicationRoleProvider.GetLogicRolesByUserId(userId));
         }
         catch (Exception ex)
         {
             transaction.Rollback();
             Trace.WriteLine("Error occurred:" + ex.Message);
             throw;
         }
         return(true);
     }
 }