示例#1
0
        public int DeleteOrder(int orderId)
        {
            Order order = _dbContext.Orders.FirstOrDefault(x => x.Id == orderId);
            ReleasedProductsDataEvent releasedProductsDataEvent = new ReleasedProductsDataEvent()
            {
                ProductsDetails = _converter.CommandToEvent(order.OrdersData)
            };

            _eventEmitter.EmitReleasedProductsDataEvent(releasedProductsDataEvent);

            _dbContext.Orders.Remove(order);
            SaveChanges();

            return((int)DeleteOrderStatusCode.DeletedSuccessfuly);
        }