コード例 #1
0
        // OrderDetail Functions started
        public int AddOrderDetail(OrderDetailDTO obj)
        {
            OrderDetailProvider provider = new OrderDetailProvider();

            if (provider.GetOrderDetailById(obj.OrderDetailId) == null)
            {
                provider.AddOrderDetail(obj);
                return(1);
            }
            return(-1);
        }
コード例 #2
0
        public int DeleteOrderDetail(int id)
        {
            OrderDetailProvider provider = new OrderDetailProvider();
            var obj = provider.GetOrderDetailById(id);

            if (obj != null)
            {
                provider.DeleteOrderDetail(obj);
                return(1);
            }
            return(-1);
        }
コード例 #3
0
        public IActionResult Get(Int32 OrderId)
        {
            try
            {
                OrderDetailProvider Provider = new OrderDetailProvider(OrderDB);
                OrderTotal          Total    = Provider.GetTotalForOrder(OrderId);

                if (Total == null)
                {
                    return(NotFound());
                }

                return(new ObjectResult(Total));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
コード例 #4
0
        public IActionResult Get(Int32 OrderId)
        {
            try
            {
                OrderDetailProvider       Provider = new OrderDetailProvider(OrderDB);
                IEnumerable <OrderDetail> Details  = Provider.GetDetailsForOrder(OrderId);

                if (Details == null)
                {
                    return(NotFound());
                }

                return(new ObjectResult(Details));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
コード例 #5
0
        public int DeleteOrder(int id)
        {
            OrderProvider provider = new OrderProvider();
            OrderDTO      obj      = provider.GetOrderById(id);
            var           orderDet = new OrderDetailProvider();

            foreach (var det in obj.OrderDetails)
            {
                var stPro = new StockOutProvider();
                foreach (var stOut in det.StockOuts)
                {
                    stPro.DeleteStockOut(stOut);
                }
                orderDet.DeleteOrderDetail(det);
            }
            if (obj != null)
            {
                provider.DeleteOrder(obj);
                return(1);
            }
            return(-1);
        }
コード例 #6
0
        public int UpdateOrderDetail(OrderDetailDTO obj)
        {
            OrderDetailProvider provider = new OrderDetailProvider();

            return(provider.UpdateOrderDetail(obj));
        }
コード例 #7
0
        public IList <OrderDetailDTO> GetOrderDetails()
        {
            OrderDetailProvider provider = new OrderDetailProvider();

            return(provider.GetAllOrderDetails());
        }
コード例 #8
0
        public OrderDetailDTO GetOrderDetail(int id)
        {
            OrderDetailProvider provider = new OrderDetailProvider();

            return(provider.GetOrderDetailById(id));
        }