private static void Add(List <Student> students) { int count = students.Count + 1; students.Add(new Student(("Dummy" + count), "Dummyson", 1)); Task1_Pasniedzeja.WriteStudentList(students); }
static void Main(string[] args) { //JSONSample(); //Task1 t1 = new Task1(); //t1.Task(); //pasniedzjea \| String filename = "Test.json"; List <Student> students = Task1_Pasniedzeja.GetStudentList(filename); if (students == null) { students = new List <Student>();//ja nav saraksta, tad incialize tuksu sarakstu //TODO create new file } while (true) { Console.WriteLine("1 - add"); Console.WriteLine("2 - display"); Console.WriteLine("0 - exit"); String choice = Console.ReadLine(); if (choice == "0")//bezgaligaja cikla swith nelieto, jo switcha break izies tikai no switch, bet ja ar if tad break iziet no while; ar return var - tad iziet no metodes { break; } else if (choice == "1") { Add(students); } else if (choice == "2") { foreach (Student st in students) { st.print(); } } } }