public Game(ModelState.Game state) : base(state) { this.GameType = new GameType(state.Type); this.characters = new ValueObjectCollection <EntityIdentity, StateIdentity>(this.State.Characters, EntityIdentity.StateFactory, EntityIdentity.ValueObjectFactory); this.players = new ValueObjectCollection <EntityIdentity, StateIdentity>(this.State.Players, EntityIdentity.StateFactory, EntityIdentity.ValueObjectFactory); }
private IValueObjectCollection <Money> GetConvertedMoneyCollection(Account account) { var moneyCollection = new ValueObjectCollection <Money>(); foreach (var targetCurrency in account.Currencies) { //ToDo Domain Policy Validation Pattern if (targetCurrency == account.Balance.SelectedCurrency) { continue; } var conversionResult = currencyService.GetConversionAmount(account.Balance.SelectedCurrency, targetCurrency, account.Balance.Amount); moneyCollection = (ValueObjectCollection <Money>)moneyCollection.AddImmutable(new Money(conversionResult.ConvertedAmountValue, conversionResult.CurrencyTo)); } return(moneyCollection); }
public Character(ModelState.Character state) : base(state) { this.assets = new ValueObjectCollection <EntityIdentity, StateIdentity>(this.State.Assets, EntityIdentity.StateFactory, EntityIdentity.ValueObjectFactory); this.accounts = new ValueObjectCollection <EntityIdentity, StateIdentity>(this.State.Accounts, EntityIdentity.StateFactory, EntityIdentity.ValueObjectFactory); }