Example #1
0
        public static void GetOrder(DTO.OrdersDto orderDto)
        {
            var db      = new PapaBobDbEntities();
            var dbOrder = db.Orders;


            var orders = new Orders();

            orders.OrderId      = orderDto.OrderId;
            orders.Size         = orderDto.Size;
            orders.Crust        = orderDto.Crust;
            orders.Sausage      = orderDto.Sausage;
            orders.Pepperoni    = orderDto.Pepperoni;
            orders.Onions       = orderDto.Onions;
            orders.GreenPeppers = orderDto.GreenPeppers;
            orders.Name         = orderDto.Name;
            orders.Adress       = orderDto.Adress;
            orders.Zip          = orderDto.Zip;
            orders.Phone        = orderDto.Phone;
            orders.TotalCost    = orderDto.TotalCost;
            orders.PaymentType  = orderDto.PaymentType;
            orders.Completed    = orderDto.Completed;

            dbOrder.Add(orders);
            db.SaveChanges();
        }
Example #2
0
        public static List <OrdersDto> retrieveOrder()
        {
            var db      = new PapaBobDbEntities();
            var OrderDb = db.Orders.Where(p => p.Completed == false).ToList();
            var order   = convertToDto(OrderDb);

            return(order);
        }
Example #3
0
        public static void completeOrder(Guid orderId)
        {
            var db    = new PapaBobDbEntities();
            var order = db.Orders.FirstOrDefault(p => p.OrderId == orderId);

            order.Completed = true;
            db.SaveChanges();
        }
Example #4
0
        public static DTO.PizzaPriceDto GetPizzaPrice()
        {
            var db       = new PapaBobDbEntities();
            var price    = db.PizzaPrice.First();
            var priceDto = new DTO.PizzaPriceDto();

            priceDto.SmallSizeCost    = price.SmallSizeCost;
            priceDto.MediumSizeCost   = price.MediumSizeCost;
            priceDto.LargeSizeCost    = price.LargeSizeCost;
            priceDto.RegularCrustCost = price.RegularCrustCost;
            priceDto.ThinCrustCost    = price.ThinCrustCost;
            priceDto.ThickCrustCost   = price.ThickCrustCost;
            priceDto.SausageCost      = price.SausageCost;
            priceDto.PepperoniCost    = price.PepperoniCost;
            priceDto.OnionsCost       = price.OnionsCost;
            priceDto.GreenPeppersCost = price.GreenPeppersCost;

            return(priceDto);
        }