Beispiel #1
0
        public void HandleRemove()
        {
            Console.WriteLine("Select employee to remove: (note: select by row number (e.g. '1')");
            var list = HandleDisplay();

            bool valid;
            int  selection;

            do
            {
                Console.WriteLine($"Select a number between 1 and {list.Count()}");
                valid = Console.ReadLine().IsValidInt(out selection);

                if (selection < 1 || selection > list.Count())
                {
                    valid = false;
                    Console.WriteLine("Input out of range.");
                }
            } while (!valid);

            var toRemove = list.ElementAt(selection - 1);

            switch (toRemove.Roles)
            {
            case Common.Roles.Ceo:
                ceoService.Remove(toRemove.Roles);
                break;

            case Common.Roles.ProjectManager:
                pmService.Remove(toRemove.Roles);
                break;

            case Common.Roles.Developer:
                devService.Remove(toRemove.Roles);
                break;

            case Common.Roles.Designer:
                dsnrService.Remove(toRemove.Roles);
                break;

            case Common.Roles.SoftwareTester:
                strService.Remove(toRemove.Roles);
                break;
            }
        }