private void When(PriceListItemAttributesChangedDomainEvent @event) { this._countryCode = @event.CountryCode; this._subscriptionPeriod = SubscriptionPeriod.Of(@event.SubscriptionPeriodCode); this._category = PriceListItemCategory.Of(@event.CategoryCode); this._price = MoneyValue.Of(@event.Price, @event.Currency); }
public void ChangeAttributes( string countryCode, SubscriptionPeriod subscriptionPeriod, PriceListItemCategory category, MoneyValue price) { var priceListItemChangedDomainEvent = new PriceListItemAttributesChangedDomainEvent(this.Id, countryCode, subscriptionPeriod.Code, category.Code, price.Value, price.Currency); this.Apply(priceListItemChangedDomainEvent); this.AddDomainEvent(priceListItemChangedDomainEvent); }
private async Task When(PriceListItemAttributesChangedDomainEvent @event) { await _connection.ExecuteScalarAsync( "UPDATE payments.PriceListItems " + "SET " + "[SubscriptionPeriodCode] = @SubscriptionPeriodCode," + "[CountryCode] = @CountryCode," + "[CategoryCode] = @CategoryCode," + "[MoneyValue] = @Price," + "[MoneyCurrency] = @Currency " + "WHERE [Id] = @PriceListItemId", new { @event.PriceListItemId, @event.SubscriptionPeriodCode, @event.CountryCode, @event.CategoryCode, @event.Price, @event.Currency }); }