示例#1
0
        void Register()
        {
            using (var toyapp = new ToyContext())
            {
                Console.Write("\nCustomer Name :-");
                var name = Console.ReadLine();

                Console.WriteLine("\nEnter Email :-");
                var email = Console.ReadLine();

                Console.WriteLine("\nEnter Mobile Number.");
                var mobile = Convert.ToInt32(Console.ReadLine());

                Console.WriteLine("\nEnter  Password.");
                var password = Console.ReadLine();

                Customer customer = new Customer(name, email, mobile, password);
                try
                {
                    toyapp.Costomers.Add(customer);
                    toyapp.SaveChanges();
                    Console.WriteLine("\nAdded Successfully\n");
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
        }
示例#2
0
        void AddToy()
        {
            using (var toyapp = new ToyContext())
            {
                Console.Write("\nEnter Toy Name : ");
                var toyName = Console.ReadLine();

                Console.WriteLine("\nWrite Description :-");
                var description = Console.ReadLine();

                Console.WriteLine("\nEnter Price :-");
                var price = Convert.ToInt32(Console.ReadLine());


                Console.WriteLine("\nEnter category id :-");
                var catId = Convert.ToInt32(Console.ReadLine());


                Toy toy = new Toy(toyName, description, price, catId);
                try
                {
                    toyapp.Toys.Add(toy);
                    toyapp.SaveChanges();
                    Console.WriteLine("\nAdded Successfully\n");
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
        }
示例#3
0
        void AddScheme()
        {
            using (var toyapp = new ToyContext())
            {
                Console.Write("\nEnter Scheme Name :- ");
                var schemeName = Console.ReadLine();

                Console.WriteLine("\nEnter Description :-");
                var description = Console.ReadLine();

                Console.WriteLine("\nEnter offeramount :- ");
                var offer = Convert.ToInt32(Console.ReadLine());

                Scheme scheme = new Scheme(schemeName, description, offer);
                try
                {
                    toyapp.Schemes.Add(scheme);
                    toyapp.SaveChanges();
                    Console.WriteLine("\nAdded Successfully\n");
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
        }
示例#4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to the portal");


            Program p = new Program();
            int     choice;
            string  Name, Password;

            using (var toyapp = new ToyContext())
            {
                do
                {
                    Console.WriteLine("Choose Option as \n\n 1. Compoany Admin \n 2. Customer\n 3. Exit ");

                    choice = Convert.ToInt32(Console.ReadLine());

                    switch (choice)
                    {
                    case 1:
                        Console.WriteLine("Enter  Name:");
                        Name = Console.ReadLine();
                        Console.WriteLine("Enter Password");
                        Password = Console.ReadLine();
                        if (Name == "admin" && Password == "admin")
                        {
                            p.Admin();
                            break;
                        }
                        else
                        {
                            Console.WriteLine("Invalid Cridentials");
                            break;
                        }

                    case 2:
                        p.Customer();
                        break;

                    case 3:
                        Console.WriteLine("Exit");
                        break;

                    default:
                        Console.WriteLine("Invalid Choice");
                        break;
                    }
                } while (choice != 3);
            }
        }
示例#5
0
        public void AddCategory()
        {
            using (var toyapp = new ToyContext())
            {
                string CategoryName;
                Console.WriteLine("\nEnter CategoryName :-");

                CategoryName = Console.ReadLine();
                var category = new Category
                {
                    CategoryName = CategoryName,
                };
                toyapp.Categories.Add(category);
                toyapp.SaveChanges();

                Console.WriteLine("\nAdded Successfully\n");
            }
        }