Exemplo n.º 1
0
        /// <summary>
        /// returns list of order details where order id match
        /// </summary>
        /// <returns></returns>
        public IList <OrderProductDTO> GetOrderDetails(int id)
        {
            IList <OrderProduct>    orderDetails    = _orderDataAccess.GetOrderDetails().Where(o => o.OrderID == id).ToList();
            IList <OrderProductDTO> orderDetailsDTO = new List <OrderProductDTO>();

            foreach (var orderProduct in orderDetails)
            {
                OrderProductDTO orderProductDTO = new OrderProductDTO();
                orderProductDTO.ID           = orderProduct.ID;
                orderProductDTO.OrderID      = orderProduct.OrderID;
                orderProductDTO.Product_id   = orderProduct.Product_id;
                orderProductDTO.Product_name = orderProduct.Product_name;
                orderProductDTO.Product_qty  = orderProduct.Product_qty;
                orderDetailsDTO.Add(orderProductDTO);
            }

            return(orderDetailsDTO);
        }