public async Task Consume(ConsumeContext <CreateShipping> context)
        {
            Console.WriteLine($"Message received: {JsonSerializer.Serialize(context.Message)}");

            var shippingOrder = ShippingOrder.Create(context.Message.UserId, context.Message.OrderId,
                                                     context.Message.ShippingTypeId);

            await _shippingOrderRepository.Add(shippingOrder);

            await _shippingOrderRepository.SaveChanges();
        }
示例#2
0
 public async Task Add(ShippingOrder shippingOrder)
 {
     await _dbContext.ShippingOrders.AddAsync(shippingOrder);
 }