示例#1
0
 public async Task Handle(Events.Added e, IMessageHandlerContext ctx)
 {
     await ctx.UoW().Add(e.TodoId, new Models.TodoResponse
     {
         Id      = e.TodoId,
         Message = e.Message,
         Active  = true
     });
 }
 public Task Handle(Events.Added e, IMessageHandlerContext ctx)
 {
     if (!MemoryDB.TryAdd(e.TodoId, new Models.TodoResponse
     {
         Id = e.TodoId,
         Message = e.Message,
         Active = true
     }))
     {
         throw new InvalidOperationException($"Todo {e.TodoId} already exists");
     }
     return(Task.CompletedTask);
 }
示例#3
0
        public Task Handle(Events.Added e, IMessageHandlerContext ctx)
        {
            var model = new Models.PaymentMethod
            {
                Id             = e.PaymentMethodId,
                UserName       = e.UserName,
                Alias          = e.Alias,
                CardholderName = e.CardholderName,
                CardNumber     = e.CardNumber,
                Expiration     = e.Expiration,
                SecurityNumber = e.SecurityNumber,
                CardType       = e.CardType.Value
            };

            return(ctx.UoW().Add(e.PaymentMethodId, model));
        }
示例#4
0
        public Task Handle(Events.Added e, IMessageHandlerContext ctx)
        {
            var model = new Models.Address
            {
                Id       = e.AddressId,
                UserName = e.UserName,
                Alias    = e.Alias,
                City     = e.City,
                State    = e.State,
                Country  = e.Country,
                Street   = e.Street,
                ZipCode  = e.ZipCode
            };

            return(ctx.UoW().Add(e.AddressId, model));
        }
示例#5
0
        public async Task Handle(Events.Added e, IMessageHandlerContext ctx)
        {
            var product = await ctx.UoW()
                          .Get <Catalog.Product.Models.CatalogProduct>(e.ProductId).ConfigureAwait(false);

            var model = new Models.OrderingOrderItem
            {
                Id                        = ItemIdGenerator(e.OrderId, e.ProductId),
                OrderId                   = e.OrderId,
                ProductId                 = e.ProductId,
                ProductName               = product.Name,
                ProductDescription        = product.Description,
                ProductPictureContents    = product.PictureContents,
                ProductPictureContentType = product.PictureContentType,
                ProductPrice              = product.Price,
                Quantity                  = e.Quantity
            };

            await ctx.UoW().Add(model.Id, model).ConfigureAwait(false);
        }
示例#6
0
        public async Task Handle(Events.Added e, IMessageHandlerContext ctx)
        {
            var brand = await ctx.UoW()
                        .Get <CatalogBrand.Models.CatalogBrand>(e.CatalogBrandId)
                        .ConfigureAwait(false);

            var type = await ctx.UoW()
                       .Get <CatalogType.Models.CatalogType>(e.CatalogTypeId)
                       .ConfigureAwait(false);

            var model = new Models.CatalogProductIndex
            {
                Id             = e.ProductId,
                Name           = e.Name,
                Price          = e.Price,
                CatalogBrand   = brand.Brand,
                CatalogBrandId = brand.Id,
                CatalogType    = type.Type,
                CatalogTypeId  = type.Id
            };

            await ctx.UoW().Add(e.ProductId, model).ConfigureAwait(false);
        }
示例#7
0
 private void Handle(Events.Added e)
 {
     this.Active  = true;
     this.Message = e.Message;
 }