Ejemplo n.º 1
0
        public bool DeleteOrder(int orderId)
        {
            //delete all order detail first
            var listOrderDetails = _orderDetailsRepository.GetByOrder(orderId);

            foreach (var item in listOrderDetails)
            {
                _orderDetailsRepository.Delete(item);
            }
            _orderDetailsRepository.Save();
            //delete order
            var order = _orderRepository.Get(orderId);

            _orderRepository.Delete(order);
            return(_orderRepository.Save());
        }