Ejemplo n.º 1
0
        public async Task Consume(ConsumeContext <DeleteOrder> context)
        {
            var Data = _inventoryServiceDbContext.Orders.FirstOrDefault(x => x.Id == context.Message.Id);

            _inventoryServiceDbContext.Orders.Remove(Data);
            await _inventoryServiceDbContext.SaveChangesAsync();
        }
Ejemplo n.º 2
0
        public async Task Consume(ConsumeContext <AddOrder> context)
        {
            // await Console.Out.WriteLineAsync(context.Message.Name);
            var order = new Order();

            order.Name = context.Message.Name;
            await _inventoryServiceDbContext.Orders.AddAsync(order);

            await _inventoryServiceDbContext.SaveChangesAsync();
        }
        public async Task Consume(ConsumeContext <UpdateOrder> context)
        {
            //var order = new Order();
            //order.Name=
            var Data = _inventoryServiceDbContext.Orders.FirstOrDefault(x => x.Id == context.Message.Id);

            if (Data == null)
            {
                return;
                //Console.WriteLine("null value");
            }
            Data.Name = context.Message.Name;
            _inventoryServiceDbContext.Orders.Update(Data);
            await _inventoryServiceDbContext.SaveChangesAsync();
        }