public List <Orders> GetOrdersByPhoneNumber([FromBody] OrderEnt model)
        {
            var query = _orderRepo.GetAll().Where(o => !o.IsDeleted && o.PhoneNumber == model.phone && o.AgencyId == null && o.CustomerId == null)
                        .ToList();

            return(query);
        }
Exemplo n.º 2
0
 public Orders(OrderEnt order)
 {
     Id = order.Id;
     foreach (var x in order.Dishes)
     {
         Dishes.Add(new Dish(x));
     }
     TimeOfOrder = order.TimeOfOrder;
 }
Exemplo n.º 3
0
        public void SaveOrder(Order order)
        {
            OrderEnt orderEnt = ConvertEntity.ConvertToOrderEnt(order);

            context.AttachRange(order.Lines.Select(l => l.Book));
            if (order.OrderId == 0)
            {
                context.Orders.Add(orderEnt);
            }
            context.SaveChanges();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Creates an item  OrderEnt
        /// </summary>
        /// <param name="orders">Convertible item Orders </param>
        /// <returns> OrderEnt</returns>
        public static OrderEnt NewOrderEnt(Orders orders)
        {
            List <DishEnt> dishEnts = new List <DishEnt>();

            foreach (var x in orders.Dishes)
            {
                dishEnts.Add(NewDishEnt(x));
            }
            OrderEnt order = new OrderEnt(dishEnts, orders.TimeOfOrder);

            return(order);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Creates an item  Orders
        /// </summary>
        /// <param name="orderEnt">Convertible item OrderEnt</param>
        /// <returns> Orders </returns>
        public static Orders NewOrders(OrderEnt orderEnt)
        {
            Orders orders = new Orders();

            orders.Id = orderEnt.Id;
            List <Dish> dishes = new List <Dish>();

            foreach (var x in orderEnt.Dishes)
            {
                dishes.Add(NewDish(x));
            }
            orders.Dishes      = dishes;
            orders.TimeOfOrder = orderEnt.TimeOfOrder;
            return(orders);
        }
Exemplo n.º 6
0
        static public Order ConvertToOrder(OrderEnt orderEnt)
        {
            List <CartLine> books = new List <CartLine>();

            foreach (var x in orderEnt.Lines)
            {
                books.Add(ConvertToCartLine(x));
            }
            Order order = new Order
            {
                Address  = orderEnt.Address,
                City     = orderEnt.City,
                Country  = orderEnt.Country,
                GiftWrap = orderEnt.GiftWrap,
                Name     = orderEnt.Name,
                OrderId  = orderEnt.OrderEntId,
                Shipped  = orderEnt.Shipped,
                Surname  = orderEnt.Surname,
                Lines    = books
            };

            return(order);
        }
Exemplo n.º 7
0
        static public OrderEnt ConvertToOrderEnt(Order order)
        {
            List <CartLineEnt> booksEnt = new List <CartLineEnt>();

            foreach (var x in order.Lines)
            {
                booksEnt.Add(ConvertToCartLineEnt(x));
            }
            OrderEnt orderEnt = new OrderEnt
            {
                Address    = order.Address,
                City       = order.City,
                Country    = order.Country,
                GiftWrap   = order.GiftWrap,
                Name       = order.Name,
                OrderEntId = order.OrderId,
                Shipped    = order.Shipped,
                Surname    = order.Surname,
                Lines      = booksEnt
            };

            return(orderEnt);
        }
Exemplo n.º 8
0
        void AddOrders(List <DishEnt> Dishe)
        {
            OrderEnt ord = new OrderEnt(Dishe);

            Unit.OrdersRepository.AddItem(ord);
        }