public bool RemoveUser(User user) { if (Users.FirstOrDefault(u => u.Id == user.Id) == null) return false; Users.Remove(user); //remove all events of the user foreach (var session in Sessions) foreach (var ev in session.Events.Where(ev=>ev.UserId == user.Id).ToArray()) session.RemoveEvent(ev); return true; }
public bool AddUser(User user) { if (Users.FirstOrDefault(u => u.Id == user.Id) != null) return false; Users.Add(user); return true; }