Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private string price;
- private string name;
- public string Name { get => name; set => name = value; }
- public string Price { get => price; set => price = value; }
- public string City { get => city; set => city = value; }
- }
- class Program
- {
- static void PartyInsert(List<party> parties)
- {
- string sName;
- string sCity;
- string sPrice;
- Console.Clear();
- Console.WriteLine("Podaj nazwę imprezy: ");
- sName = Console.ReadLine();
- Console.WriteLine("Podaj Miasto: ");
- sCity = Console.ReadLine();
- Console.WriteLine("Podaj cenę wejściówki imprezy: ");
- sPrice = Console.ReadLine();
- parties.Add(new party() { City = sCity, Price = sPrice, Name = sName });
- Console.WriteLine("Impreza Dodana");
- }
- static void Main(string[] args)
- {
- List<party> parties = new List<party>();
- string caseSwitch;
- bool end = false;
- string userCity;
- for(;end!=true;)
- {
- Console.WriteLine("Wybierz opcję\n 1. Dodawanie imprezy\n 2. Szukanie Imprezy\n 3. Wyłącz Aplikacje");
- caseSwitch = Console.ReadLine();
- switch (caseSwitch)
- {
- case "1":
- PartyInsert(parties);
- break;
- case "2":
- Console.WriteLine("Wpisz nazwę miasta w którym się znajdujesz: ");
- userCity = Console.ReadLine();
- Console.Clear();
- Console.WriteLine("Imprezy w mieście którym się znajdujesz: ");
- foreach (party aPart in parties)
- {
- if(userCity == aPart.City)
- {
- Console.WriteLine("Nazwa imprezy: " + aPart.Name + "\nCena wejścówki: " + aPart.Price + "\nMiejscowosc: " + aPart.City + "\n\n");
- }
- }
- Console.WriteLine("Imprezy z poza twojego miasta: ");
- foreach (party aPart in parties)
- {
- if (userCity != aPart.City)
- {
- Console.WriteLine("Nazwa imprezy: " + aPart.Name + "\nCena wejścówki: " + aPart.Price + "\nMiejscowosc: " + aPart.City + "\n\n");
- }
- }
- break;
- default:
- Console.WriteLine("Default case");
- end = true;
- break;
- }
- }
- foreach (party aPart in parties)
- {
- Console.WriteLine("Nazwa imprezy: " + aPart.Name + "\nCena wejścówki: " + aPart.Price + "\nMiejscowosc: " + aPart.City + "\n\n");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement