Exemple #1
0
        public static void CreateOrder(DTO.OrderDTO orderDTO)
        {
            var db = new pb4DbEntities();

            var order = ConvertToEntity(orderDTO);

            /*
             * order.OrderId = Guid.NewGuid();
             *
             * //order.Size= 1;
             * // this below works for now
             * order.Size = DTO.Enums.SizeType.Large;
             *
             * // DTO.Enums.SizeType.Large
             * order.Crust = DTO.Enums.CrustType.Thick;
             * order.Pepperoni = true;
             * order.Name = "the tech academy";
             * order.Address = "300 SW 5th Avenue";
             * order.Zip = "97201";
             * order.Phone = "123-1234";
             * order.PaymentType = DTO.Enums.PaymentType.Credit;
             * order.TotalCost = 16.50M;
             */
            db.Orders.Add(order);
            db.SaveChanges();
        }
Exemple #2
0
        public static DTO.PizzaPriceDTO GetPizzaPrices()
        {
            var db     = new pb4DbEntities();
            var prices = db.PizzaPrices.First();
            var dto    = convertToDTO(prices);

            return(dto);
        }
Exemple #3
0
        public static void CompleteOrder(Guid orderId)
        {
            var db    = new pb4DbEntities();
            var order = db.Orders.FirstOrDefault(pb4 => pb4.OrderId == orderId);

            order.Complete = true;
            db.SaveChanges();
        }
Exemple #4
0
        public static List <DTO.OrderDTO> GetOrders()
        {
            var db = new pb4DbEntities();
            // complete for completed
            var orders = db.Orders.Where(p => p.Complete == false).ToList();

            var ordersDTO = convertToDTO(orders);

            return(ordersDTO);
        }