Пример #1
0
        public static void PersonOperations(IOperations repositoryName)
        {
            Console.WriteLine("\n1.Add people  2.Delete People   3.Update Details   4. Display   5.Exit");
            Console.Write("Enter your choice  :  ");
            try
            {
                int option = Convert.ToInt16(Console.ReadLine());
                switch (option)
                {
                case 1:
                    Person newPerson = GetPersonDetails();
                    repositoryName.CreatePerson(newPerson);
                    break;

                case 2:
                    int idToDelete = GetIdToDelete();
                    repositoryName.DeletePerson(idToDelete);
                    break;

                case 3:
                    int idToUpdate = GetIdToUpdate();
                    repositoryName.Update(idToUpdate);
                    break;

                case 4:
                    repositoryName.show();
                    break;

                case 5:
                    Console.WriteLine("Application Stopped !");
                    System.Environment.Exit(0);
                    break;

                default: Console.WriteLine("Enter Valid option"); break;
                }
            }
            catch (FormatException)
            {
                Console.WriteLine("Please, Enter a valid choice !");
            }
        }