예제 #1
0
        public IEnumerable <OrderViewDTO> GetByStore(int storeID)
        {
            var orders     = _repo.GetByStore(storeID);
            var result     = orders.Translate <Order, OrderViewDTO>();
            var shipdetail = new ShippingDetail();

            foreach (var order in result)
            {
                order.details = orders.Where(x => x.ID == order.ID).Single().OrderDetails.ToList().Translate <OrderDetail, OrderDetailDTO>();

                if (orders.Where(x => x.ID == order.ID).Single().IsTaken == true)
                {
                    var shipper = _shipper.GetByStoreOrder(order.ID);
                    order.Shipper    = shipper.User.UserName;
                    order.ShipperID  = shipper.User.ID;
                    order.ShippingId = shipper.ShippingDetails.Where(x => x.OrderID == order.ID && x.IsReject == false).Single().ID;
                }
            }
            return(result);
        }