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(); }
public async Task Add(ShippingOrder shippingOrder) { await _dbContext.ShippingOrders.AddAsync(shippingOrder); }