Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- public class Client
- {
- public string name { get; set; }
- public string comp { get; set; }
- public string ip { get; set; }
- public Client()
- {
- }
- public Client(string name, string comp, string ip)
- {
- this.name = name;
- this.comp = comp;
- this.ip = ip;
- }
- }
- public class Program
- {
- private static List<Client> Clients = new List<Client>();
- public static void Main()
- {
- MenuStart();
- //dodaj do listy - Clients
- }
- public static void AddClient(List<Client> Cients)
- {
- Console.Write("Podaj nazwe klienta: ");
- string nameC = Console.ReadLine();
- Console.Write("Podaj nazwe firmy klienta: ");
- string comp = Console.ReadLine();
- Console.Write("Podaj adres ip klienta: ");
- string ip = Console.ReadLine();
- Clients.Add(new Client(nameC, comp, ip));
- resQuestion();
- }
- public static void resQuestion()
- {
- Console.WriteLine("Klient zostal dodany");
- Console.Write("Czy chcesz dodac kolejnego klienta do listy? Y/N: ");
- string nothC = Console.ReadLine();
- if (nothC == "Y")
- {
- AddClient(Clients);
- }
- else
- {
- Console.Clear();
- MenuStart();
- }
- }
- public static void ShowAll(List<Client> name)
- {
- foreach (object client in name)
- {
- }
- }
- public static void MenuStart()
- {
- Console.WriteLine("MENU WYBORU:");
- Console.WriteLine("1. Dodaj nowego klienta.");
- Console.WriteLine("2. Modyfikacja elementu.");
- Console.WriteLine("3. Usunięcie elementu.");
- Console.WriteLine("4. wyswietl elementy.");
- string strC = Console.ReadLine();
- switch (strC)
- {
- case "1":
- AddClient(Clients);
- break;
- case "2":
- Console.WriteLine(5);
- break;
- case "3":
- Console.WriteLine(5);
- break;
- case "4":
- ShowAll2(Clients);
- break;
- // Walidacja
- }
- }
- static void ShowAll2(List<Client> name)
- {
- name.ForEach(i => Console.Write("{0},{1},{2}", i.name, i.comp, i.ip));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement