Exemple #1
0
        public static User CreateUser(bool temporary)
        {
            User n = new User();

            if (temporary)
            {
                n.temporary = true;
                return(n);
            }
            else
            {
                Console.WriteLine("\nPlease input your desired username");
                string s = Console.ReadLine();
                Console.WriteLine("\nThe username you typed is: " + s + "\nIs this acceptable? (Y/N)");
                if (YesNo())
                {
                    n.Name = s;
                    _sql.Save(n);
                    n = _sql.ReadOneUser(s);
                    Console.WriteLine($"\nThank you for creating an account with us! \nYour User ID is {n.Id} and your Username is {s}");
                    return(n);
                }
                else
                {
                    return(CreateUser(false));
                }
            }
        }
Exemple #2
0
        static void PrebuiltPizza()
        {
            if (_sql.ReadPizzas().Count() == 0)
            {
                Console.WriteLine("No Pizza found in DB! Adding pizzas");
                Crust          c  = _sql.ReadCrust().FirstOrDefault(x => x.name.Contains("Hand Tossed"));
                Size           s  = _sql.ReadSize().FirstOrDefault(x => x.name.Contains("Medium"));
                Topping        t1 = _sql.ReadTopping().FirstOrDefault(x => x.name.Contains("Premium Chicken"));
                Topping        t2 = _sql.ReadTopping().FirstOrDefault(x => x.name.Contains("Cheese"));
                List <Topping> t  = new List <Topping> {
                    t1, t2
                };
                APizzaModel meatpizza1 = new Pizza(c, s, t);
                meatpizza1.name = "Medium Hand Tossed Meat Pizza";
                _sql.Save(meatpizza1);


                c  = _sql.ReadCrust().FirstOrDefault(x => x.name.Contains("Cheese-Stuffed"));
                s  = _sql.ReadSize().FirstOrDefault(x => x.name.Contains("Large"));
                t1 = _sql.ReadTopping().FirstOrDefault(x => x.name.Contains("Premium Chicken"));
                t2 = _sql.ReadTopping().FirstOrDefault(x => x.name.Contains("Cheese"));
                Topping t3 = _sql.ReadTopping().FirstOrDefault(x => x.name.Contains("Pulled Pork"));
                Topping t4 = _sql.ReadTopping().FirstOrDefault(x => x.name.Contains("Mushroom"));
                t = new List <Topping> {
                    t1, t2, t3, t4
                };
                APizzaModel meatpizza2 = new Pizza(c, s, t);
                meatpizza2.name = "Large Cheese Stuffed King of Pizza";
                _sql.Save(meatpizza2);

                c  = _sql.ReadCrust().FirstOrDefault(x => x.name.Contains("Thin"));
                s  = _sql.ReadSize().FirstOrDefault(x => x.name.Contains("Small"));
                t1 = _sql.ReadTopping().FirstOrDefault(x => x.name.Contains("Cheese"));
                t  = new List <Topping> {
                    t1
                };
                APizzaModel cheesepizza = new Pizza(c, s, t);
                cheesepizza.name = "Small thin crust cheese pizza";
                _sql.Save(cheesepizza);
            }
            else
            {
                Console.WriteLine("Pizza Not empty");
            }
        }