Exemple #1
0
 public async Task AddAddress()
 {
     using (var context = new ShopContext())
     {
         Address address = new Address();
         Console.WriteLine("Please, indicate a city.");
         address.City = Console.ReadLine();
         Console.WriteLine("Please, indicate a street.");
         address.Street = Console.ReadLine();
         Console.WriteLine("Please, indicate a building number.");
         address.HouseNumber = Console.ReadLine();
         context.SaveChanges();
         Console.WriteLine("The address is added. Do you want to add other addresses? (Y/N)");
         while (true)
         {
             string answer = Console.ReadLine();
             if (answer.ToLower() == "y")
             {
                 await AddAddress(); break;
             }
             else if (answer.ToLower() == "n")
             {
                 await Management.ManageAddresses(); break;
             }
             else
             {
                 Console.WriteLine("Invalid input. Try again.");
             }
         }
     }
 }
Exemple #2
0
 public async Task GoManaging()
 {
     Console.WriteLine("What do you want to manage?\n1 - Addresses\n2 - Shops\n3 - Sellers\n4 - Items");
     while (true)
     {
         Int32.TryParse(Console.ReadLine(), out int managerChoice);
         if (managerChoice < 1 || managerChoice > 4)
         {
             Console.WriteLine("Invalid selection. Try again");
         }
         else
         {
             ManagingOptions options = new ManagingOptions();
             if (managerChoice == 1)
             {
                 await options.ManageAddresses();
             }
             else if (managerChoice == 2)
             {
                 await options.ManageShops();
             }
             else if (managerChoice == 3)
             {
                 await options.ManageSellers();
             }
             else if (managerChoice == 4)
             {
                 await options.ManageItems();
             }
         }
     }
 }