public static void AddUserToGroup(UserInfo userInfo, GroupInfo groupInfo) { var user = GetUserWithEmail(userInfo.Email); var ug = new UserGroup(); ug.GroupId = groupInfo.Id; ug.UserId = user.Id; UserGroupBL.AddUserGroup(ug); }
public static void RemoveUserFromGroup(UserInfo userInfo, GroupInfo groupInfo) { var user = GetUserWithEmail(userInfo.Email); var ug = user.UserGroups.ToList().Find(ug => ug.GroupId == groupInfo.Id); UserGroupBL.RemoveUserGroup(ug); var group = GroupBL.GetGroup(groupInfo.Id); if (GroupBL.isEmpty(group)) { GroupBL.RemoveGroup(group); } }