public void Remove(long studentId, long courseId) => Locker.RunWriteAction(() => { Logger.LogRemoveStarted(); if (!Accepted.ContainsKey(studentId)) { Logger.LogRemoveFinished(); return; } Accepted[studentId]?.Remove(courseId); Logger.LogRemoveFinished(); });
public bool Contains(long studentId, long courseId) => Locker.RunReadAction(() => { Logger.LogQueryStarted(); if (!Accepted.ContainsKey(studentId)) { Logger.LogQueryFinished(); return(false); } bool result = Accepted[studentId]?.Contains(courseId) ?? false; Logger.LogQueryFinished(); return(result); });
public void Add(long studentId, long courseId) => Locker.RunWriteAction(() => { Logger.LogAddStarted(); if (Accepted.ContainsKey(studentId)) { Accepted[studentId]?.Add(courseId); Logger.LogAddFinished(); return; } Accepted[studentId] = new List <long> { courseId }; Logger.LogAddFinished(); });