static void Main() { StudentSystem studentSystem = new StudentSystem(); string input; while ((input = Console.ReadLine()) != "Exit") { string[] args = input.Split(); if (args[0] == "Create") { studentSystem.Create(args[1], int.Parse(args[2]), double.Parse(args[3])); } else if (args[0] == "Show") { studentSystem.Show(args[1]); } } }
public bool Execute(Command command) { switch (command.Type) { case "Create": var student = parser.GetStudent(command.Arguments); studentSystem.Add(student); return(true); case "Show": string name = command.Arguments[0]; writer.PrintOutput(studentSystem.Show(name)); return(true); case "Exit": break; } return(false); }
public void ParseCommand(string input) { string[] command = input.Split(new char[] { ' ' }, StringSplitOptions.None).ToArray(); StudentSystem StudentSystem = new StudentSystem(); switch (command[0]) { case "Create": StudentSystem.Create(command); break; case "Show": StudentSystem.Show(command); break; case "Exit": Environment.Exit(0); break; } }