public static void Main (string[] args) { string action; StudentContainer sl = new StudentContainer (); action = Operations.validateAction (); while(action == "ENLIST" || action=="DISPLAY") { switch(action){ case "ENLIST": Student st = new Student () { firstName = Operations.validateNames ("First"), lastName = Operations.validateNames ("Last"), GPA = Operations.validateGPA () }; sl.AddStudent (st); action = Operations.validateAction (); break; case "DISPLAY": if (sl.Count == 0) { Console.WriteLine ("There are no students to display!"); } else { sl.Sort("lastname"); foreach (Student s in sl) { s.PrintDetails (); } } action = Operations.validateAction (); break; } } }
//singleton pattern za listu public static StudentContainer Instance() { if (instance == null) { instance = new StudentContainer(); } return(instance); }
public static StudentContainer getInstance() { if (studentContainer == null) { studentContainer = new StudentContainer(); return(studentContainer); } return(studentContainer); }
//static Student student = new Student(); public static void EnlistStudent() { var student = new Student(); Console.WriteLine("-------------> ENLIST <-------------"); FirstName(student); LastName(student); GPA(student); StudentContainer.AddStudent(student); }
public StudentService() { storage = StudentContainer.Instance; }