public async Task Handle(Commands.ClaimBasket command, IMessageHandlerContext ctx) { var basket = await ctx.For <Basket>().Get(command.BasketId).ConfigureAwait(false); var user = await ctx.For <Identity.User.User>().Get(command.UserName).ConfigureAwait(false); basket.Claim(user.State); }
public async Task Handle(Commands.Add command, IMessageHandlerContext ctx) { var location = await ctx.For <Location>().New(command.LocationId).ConfigureAwait(false); var parent = await ctx.For <Location>().TryGet(command.ParentId).ConfigureAwait(false); location.Add(command.Code, command.Description, parent?.State); }
public async Task Handle(Commands.Remove command, IMessageHandlerContext ctx) { var buyer = await ctx.For <Buyer>().Get(command.UserName).ConfigureAwait(false); var method = await ctx.For <PaymentMethod>().Get(command.PaymentMethodId).ConfigureAwait(false); method.Remove(); }
public async Task Handle(Commands.Remove command, IMessageHandlerContext ctx) { var order = await ctx.For <Order>().Get(command.OrderId).ConfigureAwait(false); var item = await ctx.For <Item>().Get(command.ProductId).ConfigureAwait(false); item.Remove(); }
public async Task Handle(Commands.Add command, IMessageHandlerContext ctx) { var order = await ctx.For <Order>().Get(command.OrderId).ConfigureAwait(false); var item = await ctx.For <Item>().New(command.ProductId).ConfigureAwait(false); item.Add(command.Quantity); }
public async Task Handle(Commands.Initiate command, IMessageHandlerContext ctx) { var basket = await ctx.For <Basket>().New(command.BasketId).ConfigureAwait(false); var user = await ctx.For <Identity.User.User>().TryGet(command.UserName).ConfigureAwait(false); basket.Initiate(user?.State); }
public async Task Handle(Commands.Remove command, IMessageHandlerContext ctx) { var buyer = await ctx.For <Buyer>().Get(command.UserName).ConfigureAwait(false); var address = await ctx.For <Address>().Get(command.AddressId).ConfigureAwait(false); address.Remove(); }
public async Task Handle(Commands.Record command, IMessageHandlerContext ctx) { var record = await ctx.For <User>().New(command.RecordId).ConfigureAwait(false); var location = await ctx.For <Location.Location>().Get(command.LocationId).ConfigureAwait(false); var user = await ctx.For <Identity.User.User>().Get(command.UserId).ConfigureAwait(false); record.Record(location.State, user.State); }
public async Task Handle(Commands.Add command, IMessageHandlerContext ctx) { var product = await ctx.For <Product>().New(command.ProductId).ConfigureAwait(false); var brand = await ctx.For <CatalogBrand.Brand>().Get(command.CatalogBrandId).ConfigureAwait(false); var type = await ctx.For <CatalogType.Type>().Get(command.CatalogTypeId).ConfigureAwait(false); product.Add(command.Name, command.Price, brand.State, type.State); }
public async Task Handle(Commands.ChangePaymentMethod command, IMessageHandlerContext ctx) { var order = await ctx.For <Order>().Get(command.OrderId).ConfigureAwait(false); var buyer = await ctx.For <Buyer.Buyer>().Get(order.State.UserName).ConfigureAwait(false); var method = await ctx.For <Buyer.Entities.PaymentMethod.PaymentMethod>().Get(command.PaymentMethodId).ConfigureAwait(false); order.ChangePaymentMethod(method.State); }
public async Task Handle(SayHello command, IMessageHandlerContext ctx) { var world = await ctx.For <World>().TryGet("World"); if (world == null) { world = await ctx.For <World>().New("World"); } world.SayHello(command.Message); }
public async Task Handle(Commands.Charge command, IMessageHandlerContext ctx) { var payment = await ctx.For <Payment>().New(command.PaymentId).ConfigureAwait(false); var buyer = await ctx.For <Ordering.Buyer.Buyer>().Get(command.UserName).ConfigureAwait(false); var order = await ctx.For <Ordering.Order.Order>().Get(command.OrderId).ConfigureAwait(false); var method = await buyer.For <Ordering.Buyer.Entities.PaymentMethod.PaymentMethod>().Get(command.PaymentMethodId).ConfigureAwait(false); payment.Charge(buyer.State, order.State, method.State); }
public async Task Handle(Commands.ChangeAddress command, IMessageHandlerContext ctx) { var order = await ctx.For <Order>().Get(command.OrderId).ConfigureAwait(false); var buyer = await ctx.For <Buyer.Buyer>().Get(order.State.UserName).ConfigureAwait(false); var shipping = await ctx.For <Buyer.Entities.Address.Address>().Get(command.ShippingId).ConfigureAwait(false); var billing = await ctx.For <Buyer.Entities.Address.Address>().Get(command.BillingId).ConfigureAwait(false); order.ChangeAddress(shipping.State, billing.State); }
public async Task Handle(SayHello command, IMessageHandlerContext ctx) { var world = await ctx.For <World>().TryGet("World"); if (world == null) { world = await ctx.For <World>().New("World"); world.Create(); } var message = await world.For <Message>().New(Guid.NewGuid()); message.SayHello(command.Message); }
public async Task Handle(Commands.AddItem command, IMessageHandlerContext ctx) { var basket = await ctx.For <Basket>().Get(command.BasketId).ConfigureAwait(false); // allow user to add product, remove product, re-add product var item = await basket.For <Item>().TryGet(command.ProductId).ConfigureAwait(false); if (item == null) { item = await basket.For <Item>().New(command.ProductId).ConfigureAwait(false); } var product = await ctx.For <Catalog.Product.Product>().Get(command.ProductId).ConfigureAwait(false); item.Add(); }
public async Task Handle(Commands.Draft command, IMessageHandlerContext ctx) { var buyer = await ctx.For <Buyer.Buyer>().Get(command.UserName).ConfigureAwait(false); var basket = await ctx.For <Basket.Basket.Basket>().Get(command.BasketId).ConfigureAwait(false); var order = await ctx.For <Order>().New(command.OrderId).ConfigureAwait(false); var shipping = await buyer.For <Buyer.Entities.Address.Address>().Get(command.ShippingAddressId).ConfigureAwait(false); var billing = await buyer.For <Buyer.Entities.Address.Address>().Get(command.BillingAddressId).ConfigureAwait(false); var method = await buyer.For <Buyer.Entities.PaymentMethod.PaymentMethod>().Get(command.PaymentMethodId).ConfigureAwait(false); order.Draft(buyer.State, basket.State, shipping.State, billing.State, method.State); }
public async Task Handle(Commands.RemoveItem command, IMessageHandlerContext ctx) { var basket = await ctx.For <Basket>().Get(command.BasketId).ConfigureAwait(false); var item = await basket.For <Item>().Get(command.ProductId).ConfigureAwait(false); item.Remove(); }
public async Task Handle(Commands.Add command, IMessageHandlerContext ctx) { var buyer = await ctx.For <Buyer>().Get(command.UserName).ConfigureAwait(false); var address = await buyer.For <Address>().New(command.AddressId).ConfigureAwait(false); address.Add(command.Alias, command.Street, command.City, command.State, command.Country, command.ZipCode); }
public async Task Handle(Commands.Remove command, IMessageHandlerContext ctx) { var location = await ctx.For <Location>().Get(command.LocationId).ConfigureAwait(false); var point = await location.For <Point>().Get(command.PointId).ConfigureAwait(false); point.Remove(); }
public async Task Handle(Commands.Add command, IMessageHandlerContext ctx) { var location = await ctx.For <Location>().Get(command.LocationId).ConfigureAwait(false); var point = await location.For <Point>().New(command.PointId).ConfigureAwait(false); point.Add(command.Longitude, command.Latitude); }
public async Task Handle(Commands.Revoke command, IMessageHandlerContext ctx) { var user = await ctx.For <User>().Get(command.UserName).ConfigureAwait(false); var role = await user.For <Role>().Get(command.RoleId).ConfigureAwait(false); role.Revoke(); }
public async Task Handle(Commands.Add command, IMessageHandlerContext ctx) { var campaign = await ctx.For <Campaign>().Get(command.CampaignId).ConfigureAwait(false); var rule = await campaign.For <Rule>().New(command.RuleId).ConfigureAwait(false); rule.Add(command.Description); }
public async Task Handle(Commands.UpdateQuantity command, IMessageHandlerContext ctx) { var basket = await ctx.For <Basket>().Get(command.BasketId).ConfigureAwait(false); var item = await basket.For <Item>().Get(command.ProductId).ConfigureAwait(false); item.UpdateQuantity(command.Quantity); }
public async Task Handle(Commands.SetPreferredPaymentMethod command, IMessageHandlerContext ctx) { var buyer = await ctx.For <Buyer>().Get(command.UserName).ConfigureAwait(false); var method = await buyer.For <Entities.PaymentMethod.PaymentMethod>().Get(command.PaymentMethodId).ConfigureAwait(false); buyer.SetPreferredPaymentMethod(method.State); }
public async Task Handle(Commands.SetPreferredAddress command, IMessageHandlerContext ctx) { var buyer = await ctx.For <Buyer>().Get(command.UserName).ConfigureAwait(false); var address = await buyer.For <Entities.Address.Address>().Get(command.AddressId).ConfigureAwait(false); buyer.SetPreferredAddress(address.State); }
public async Task Handle(Commands.Remove command, IMessageHandlerContext ctx) { var campaign = await ctx.For <Campaign>().Get(command.CampaignId).ConfigureAwait(false); var rule = await campaign.For <Rule>().Get(command.RuleId).ConfigureAwait(false); rule.Remove(); }
public async Task Handle(Commands.Add command, IMessageHandlerContext ctx) { var buyer = await ctx.For <Buyer>().Get(command.UserName).ConfigureAwait(false); var method = await buyer.For <PaymentMethod>().New(command.PaymentMethodId).ConfigureAwait(false); method.Add(command.Alias, command.CardNumber, command.SecurityNumber, command.CardholderName, command.Expiration, command.CardType); }
public async Task Handle(Commands.Seed command, IMessageHandlerContext ctx) { var setup = await ctx.For <Setup>().Get("setup").ConfigureAwait(false); var users = await setup.For <Identity>().New("identity").ConfigureAwait(false); await Import.Seed(ctx).ConfigureAwait(false); users.Seeded(); }
public async Task Handle(Commands.Seed command, IMessageHandlerContext ctx) { var setup = await ctx.For <Setup>().Get("setup").ConfigureAwait(false); var ordering = await setup.For <Orders>().New("ordering").ConfigureAwait(false); await Import.Seed(ctx).ConfigureAwait(false); ordering.Seeded(); }
public async Task Handle(Commands.Seed command, IMessageHandlerContext ctx) { var setup = await ctx.For <Setup>().Get("setup").ConfigureAwait(false); var basket = await setup.For <Basket>().New("basket").ConfigureAwait(false); await Import.Seed(ctx).ConfigureAwait(false); basket.Seeded(); }