public void RequestPerformed(Guid sessionId, string clientId) { Requests.AddOrUpdate(sessionId, 1, (k, v) => v += 1); if (!string.IsNullOrWhiteSpace(clientId)) { Clients.AddOrUpdate( sessionId, new List <string>() { clientId }, (k, v) => { if (!v.Contains(clientId)) { v.Add(clientId); } return(v); }); } UpdateSessionStats(new SessionStats() { Id = sessionId, RequestsPerformed = Requests[sessionId], TotalClientsCount = Clients[sessionId].Count, WordsSubmitted = Words.ContainsKey(sessionId) ? Words[sessionId] : 0 }); }
public void AddRequest(int fromUserID, int toUserID, int taskID, DateTime dt, string Note) { Request _request = new Request(); _request.FromUserID = fromUserID; _request.ToUserID = toUserID; _request.TaskID = taskID; _request.TransferDateTime = dt; _request.Note = Note; ChangeTracker.DetectChanges(); Requests.AddOrUpdate(_request); SaveChanges(); }