public bool Remove(IUserSession session) { var result = sessions.Remove(session); if (result) { SessionsUpdated?.Invoke(); } return(result); }
public bool Add(IUserSession session) { var result = false; lock (sessions) { if (sessions.Select(s => s.Username).Contains(session.Username)) { result = false; } else { sessions.Add(session); result = true; } } if (result) { SessionsUpdated?.Invoke(); } return(result); }