コード例 #1
0
        private void CommandSelected(object sender, EventArgs e)
        {
            string cmd = (string)sender;

            switch (cmd)
            {
            case "1":
                List <Client> clients       = _repository.GetClients().ToList();
                string        clientsString = "";
                for (int i = 0; i < clients.Count; i++)
                {
                    clientsString += string.Format("{0},{1},{2}\n", clients[i].Id, clients[i].Name, clients[i].Age);
                }
                _clientView.DisplayListOfClients(clientsString);
                break;

            case "2":
                _clientView.DisplayMessageForSelect();
                break;

            case "3":
                _clientView.DisplayMessageForRemove();
                break;

            case "4":
                _repository.Save();
                _clientView.DisplaySuccessSave();
                break;

            case "x":
                _clientView.Close();
                break;

            case "X":
                _clientView.Close();
                break;

            default:
                break;
            }
        }