private void ImplementUserChanges(int entryId, int userId, UserLastChanges changes) { if (changes.IsNameChanged) { AddEntry(entryId, userId, changes.NameChange.Value, changes.NameChange.TimeStamp); } if (changes.IsStateChanged) { if (changes.StateChange.Value == EntryState.Done) { MarkDone(entryId, userId, changes.StateChange.TimeStamp); } else { MarkUndone(entryId, userId, changes.StateChange.TimeStamp); } } if (changes.IsExistenceChanged) { if (changes.ExistenceChange.Value == ExistenceState.Added) { AddEntry(entryId, userId, changes.NameChange.Value, changes.ExistenceChange.TimeStamp); } else { RemoveEntry(entryId, userId, changes.ExistenceChange.TimeStamp); } } }
private void InitializeUserChangesToEntry(int entryId, int userId) { if (!usersLastChangesToEntry.ContainsKey(userId)) { usersLastChangesToEntry[userId] = new Dictionary <int, UserLastChanges>(); } if (!usersLastChangesToEntry[userId].ContainsKey(entryId)) { usersLastChangesToEntry[userId][entryId] = new UserLastChanges(); } }