Ejemplo n.º 1
0
        public Customer Loggedin(BitStoreDB ctx, Customer loggedInCustomer)
        {
            var customers = ctx.Customers.ToList();

            Console.WriteLine("Please enter id:");
            int input = int.Parse(Console.ReadLine());

            Customer[] custarr = customers.ToArray();
            loggedInCustomer = custarr[input];
            return(loggedInCustomer);
        }
Ejemplo n.º 2
0
        public Customer CreateCustomer(BitStoreDB ctx, Customer c)
        {
            Console.WriteLine("Please Enter your name");
            c.Name = Console.ReadLine();
            Console.WriteLine("How much would you like to put in your account?");
            c.CashOnHand = decimal.Parse(Console.ReadLine());
            ctx.Customers.Add(c);

            //  ctx.SaveChanges();
            return(c);
        }
Ejemplo n.º 3
0
Archivo: Screen.cs Proyecto: dpasc/4fun
        public void StartShopping(BitStoreDB ctx, List <Product> products)
        {
            Console.WriteLine("What would you like to purchase? \n");
            Console.WriteLine("Bellow is our catalogue please eneter the item id number and press eneter to add to cart.");
            //Diplay products
            Console.WriteLine("Id________Name_______Price $");

            foreach (var p in products)
            {
                Console.WriteLine($"{p.Id}-----{ p.Name}-----{ p.Price}");
                Console.WriteLine("_______________________________________________________________");
            }
        }
Ejemplo n.º 4
0
Archivo: SeedDb.cs Proyecto: dpasc/4fun
 public void SeedCategories(BitStoreDB ctx)
 {
     ctx.Categories.Add(new Category {
         Name = "Fruit/Veg"
     });
     ctx.Categories.Add(new Category {
         Name = "Bakery"
     });
     ctx.Categories.Add(new Category {
         Name = "Drinks"
     });
     ctx.Categories.Add(new Category {
         Name = "House Hold"
     });
     ctx.Categories.Add(new Category {
         Name = "Snacks"
     });
     ctx.SaveChanges();
 }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            BitStoreDB ctx = new BitStoreDB();
            Customer   c   = new Customer();
            Screen     s   = new Screen();
            var        p   = new Product();

            var customers = ctx.Customers;

            var products = ctx.Products.ToList();



            var loggedInCustomer = new Customer();


            //Welcome Screen
            s.Welcome();
            int loginSelect = int.Parse(Console.ReadLine());
            var validate    = false;

            while (validate == false)
            {
                if (loginSelect == 1)
                {
                    loggedInCustomer = c.CreateCustomer(ctx, loggedInCustomer);
                    validate         = true;
                }
                else if (loginSelect == 2)
                {
                    loggedInCustomer = c.Loggedin(ctx, loggedInCustomer);
                    validate         = true;
                }
                else
                {
                    Console.WriteLine("Please enter a valid option");
                    Console.Beep();
                    Console.Beep();
                    loginSelect = int.Parse(Console.ReadLine());
                }
            }
            ;
            Console.WriteLine($"Hello {loggedInCustomer.Name}");
            Console.WriteLine($"You have ${loggedInCustomer.CashOnHand} in your account");


            //Start shopping

            s.StartShopping(ctx, products);


            // Create a sale that will allow 10 items


            //add items to sale list as selected



            //Show total



            // pay for items

            Console.Read();
        }
Ejemplo n.º 6
0
        //To-Do create get id method
        public List <Customer> GetCustomers(BitStoreDB ctx)
        {
            var customers = ctx.Customers.ToList();

            return(customers);
        }
Ejemplo n.º 7
0
Archivo: SeedDb.cs Proyecto: dpasc/4fun
        public void SeedProducts(BitStoreDB ctx)
        {
            //Fruit + Veg
            ctx.Products.Add(new Product {
                Name = "Apple", Price = 0.55M, CategoryId = 2
            });
            ctx.Products.Add(new Product {
                Name = "Orange", Price = 0.55M, CategoryId = 2
            });
            ctx.Products.Add(new Product {
                Name = "Potato", Price = 0.75M, CategoryId = 2
            });
            ctx.Products.Add(new Product {
                Name = "Banana", Price = 0.35M, CategoryId = 2
            });
            ctx.Products.Add(new Product {
                Name = "Watermelon", Price = 2.75M, CategoryId = 2
            });
            ctx.Products.Add(new Product {
                Name = "Pine Apple", Price = 1.80M, CategoryId = 2
            });
            ctx.Products.Add(new Product {
                Name = "Cabbage", Price = 0.95M, CategoryId = 2
            });
            ctx.Products.Add(new Product {
                Name = "Ginger", Price = 0.25M, CategoryId = 2
            });
            ctx.Products.Add(new Product {
                Name = "Mushroom", Price = 0.42M, CategoryId = 2
            });
            ctx.Products.Add(new Product {
                Name = "Eggplant", Price = 2.00M, CategoryId = 2
            });
            ctx.Products.Add(new Product {
                Name = "Tomatoe", Price = 1.50M, CategoryId = 2
            });


            //Bakery
            ctx.Products.Add(new Product {
                Name = "Tip-Top", Price = 2.00M, CategoryId = 3
            });
            ctx.Products.Add(new Product {
                Name = "Muffin", Price = 0.72M, CategoryId = 3
            });
            ctx.Products.Add(new Product {
                Name = "Mud Cake", Price = 5.50M, CategoryId = 3
            });
            ctx.Products.Add(new Product {
                Name = "Wraps", Price = 3.60M, CategoryId = 3
            });
            ctx.Products.Add(new Product {
                Name = "Baguette", Price = 2.55M, CategoryId = 3
            });
            ctx.Products.Add(new Product {
                Name = "English Muffins 6pk", Price = 2.65M, CategoryId = 3
            });
            ctx.Products.Add(new Product {
                Name = "Apple Crumble", Price = 4.99M, CategoryId = 3
            });
            ctx.Products.Add(new Product {
                Name = "Rye Bread", Price = 3.60M, CategoryId = 3
            });
            ctx.Products.Add(new Product {
                Name = "Sourdough Roll", Price = 0.78M, CategoryId = 3
            });
            ctx.Products.Add(new Product {
                Name = "Pikelets 12pk", Price = 4.50M, CategoryId = 3
            });
            ctx.Products.Add(new Product {
                Name = "Dinner Roll", Price = 0.30M, CategoryId = 3
            });


            //Drinks
            ctx.Products.Add(new Product {
                Name = "Sparkling Water", Price = 0.90M, CategoryId = 4
            });
            ctx.Products.Add(new Product {
                Name = "Coke Cola", Price = 1.20M, CategoryId = 4
            });
            ctx.Products.Add(new Product {
                Name = "Pepsi", Price = 1.00M, CategoryId = 4
            });
            ctx.Products.Add(new Product {
                Name = "String Valley Orange Mango", Price = 2.30M, CategoryId = 4
            });
            ctx.Products.Add(new Product {
                Name = "Cream n Soda", Price = 0.90M, CategoryId = 4
            });
            ctx.Products.Add(new Product {
                Name = "Sprite", Price = 0.98M, CategoryId = 4
            });
            ctx.Products.Add(new Product {
                Name = "Ginger Beer", Price = 1.25M, CategoryId = 4
            });
            ctx.Products.Add(new Product {
                Name = "Red Bull", Price = 0.99M, CategoryId = 4
            });
            ctx.Products.Add(new Product {
                Name = "Lift", Price = 0.90M, CategoryId = 4
            });
            ctx.Products.Add(new Product {
                Name = "Fanta", Price = 0.92M, CategoryId = 4
            });
            ctx.Products.Add(new Product {
                Name = "Ice Tea", Price = 1.25M, CategoryId = 4
            });

            //House hold
            ctx.Products.Add(new Product {
                Name = "Toilet Paper 12pk", Price = 5.85M, CategoryId = 5
            });
            ctx.Products.Add(new Product {
                Name = "Mop", Price = 5.00M, CategoryId = 5
            });
            ctx.Products.Add(new Product {
                Name = "Dustpan", Price = 3.25M, CategoryId = 5
            });
            ctx.Products.Add(new Product {
                Name = "Frypan", Price = 20.55M, CategoryId = 5
            });
            ctx.Products.Add(new Product {
                Name = "Tea Towel", Price = 6.00M, CategoryId = 5
            });
            ctx.Products.Add(new Product {
                Name = "Foil Wrap 660M", Price = 2.36M, CategoryId = 5
            });
            ctx.Products.Add(new Product {
                Name = "Oven Gloves", Price = 6.50M, CategoryId = 5
            });
            ctx.Products.Add(new Product {
                Name = "Mortein", Price = 3.66M, CategoryId = 5
            });
            ctx.Products.Add(new Product {
                Name = "Garbage Bags 200pk", Price = 4.55M, CategoryId = 5
            });
            ctx.Products.Add(new Product {
                Name = "Paper Towels 2pk", Price = 2.55M, CategoryId = 5
            });
            ctx.Products.Add(new Product {
                Name = "Tissues 240pk", Price = 1.99M, CategoryId = 5
            });

            //Snacks
            ctx.Products.Add(new Product {
                Name = "Snickers", Price = 2.00M, CategoryId = 6
            });
            ctx.Products.Add(new Product {
                Name = "Mars", Price = 2.00M, CategoryId = 6
            });
            ctx.Products.Add(new Product {
                Name = "Twisties", Price = 0.99M, CategoryId = 6
            });
            ctx.Products.Add(new Product {
                Name = "Ice Cream", Price = 4.95M, CategoryId = 6
            });
            ctx.Products.Add(new Product {
                Name = "Cookies", Price = 2.75M, CategoryId = 6
            });
            ctx.Products.Add(new Product {
                Name = "Trail Mix", Price = 4.00M, CategoryId = 6
            });
            ctx.Products.Add(new Product {
                Name = "Popcorn", Price = 1.99M, CategoryId = 6
            });
            ctx.Products.Add(new Product {
                Name = "Original Chips", Price = 0.99M, CategoryId = 6
            });
            ctx.Products.Add(new Product {
                Name = "Pringles", Price = 2.70M, CategoryId = 6
            });
            ctx.Products.Add(new Product {
                Name = "Twix", Price = 2.00M, CategoryId = 6
            });
            ctx.Products.Add(new Product {
                Name = "Gummy Bears", Price = 1.75M, CategoryId = 6
            });



            ctx.SaveChanges();
        }