public static List <DTO.OrderDTO> GetOrders()
        {
            var db        = new PapaBobsDbEntities();
            var orders    = db.Orders.Where(p => p.Completed == false).ToList();
            var ordersDTO = convertToDTO(orders);

            return(ordersDTO);
        }
        public static void CreateOrder(DTO.OrderDTO orderDTO)
        {
            var db    = new PapaBobsDbEntities();
            var order = convertToEntity(orderDTO);

            db.Orders.Add(order);
            db.SaveChanges();
        }
Ejemplo n.º 3
0
        public static void CompleteOrder(Guid orderId)
        {
            var db    = new PapaBobsDbEntities();
            var order = db.Orders.FirstOrDefault(p => p.OrderId == orderId);

            order.Completed = true;
            db.SaveChanges();
        }
        public static DTO.PizzaPriceDTO GetPizzaPrices()
        {
            var db     = new PapaBobsDbEntities();
            var prices = db.PizzaPrices.First();
            var dto    = convertToDTO(prices);

            return(dto);
        }
Ejemplo n.º 5
0
        public static void CreateOrder(DTO.OrderDTO orderDTO)
        {
            var db = new PapaBobsDbEntities();

            // Call helper method to convert the order into the proper type.
            var order = convertToEntity(orderDTO);

            db.Orders.Add(order);
            db.SaveChanges();
        }
Ejemplo n.º 6
0
        public static void CreateOrder(DTO.OrderDTO orderDTO)
        {
            var db = new PapaBobsDbEntities();

            //var order = new Order();


            //order.OrderId = Guid.NewGuid();
            //order.Size = 1;
            //order.Crust = 0;
            //order.Pepperoni = true;
            //order.Name = "Test";
            //order.Address = "123 Elm";
            //order.ZipCode = "12345";
            //order.Phone = "555-5555";
            //order.PaymentType = 0;
            //order.TotalCost = 16.50M;

            db.Orders.Add((Order)convertToEntity((OrderDTO)orderDTO));
            db.SaveChanges();
        }