public ChangeAgreementEvent CreateChangeAgreementEvent(int agrId, Dictionary <string, int> changes, int valeur) { if (!Agreements.Any(x => x.Id.Equals(agrId))) { return(null); } var ce = new ChangeAgreementEvent(agrId, changes, valeur); AgreementEvents.Add(ce); return(ce); }
private Agreement ApplyChange(Agreement result, ChangeAgreementEvent evt) { result = new Agreement(new Dictionary <string, int>(result.Values), evt.ValeurDate) { Id = Id }; foreach (var change in evt.Changes) { if (result.Values.ContainsKey(change.Key)) { result.Values[change.Key] = change.Value; } else { result.Values.Add(change.Key, change.Value); } } return(result); }