Ejemplo n.º 1
0
        public static Project SelectionProjectMenu(List <Project> projects)
        {
            ConsoleServices.PrintMenu(projects);
            int projectNumber = -1;
            var input         = Console.ReadLine();

            if (!int.TryParse(input, out projectNumber) ||
                projectNumber <= 0 ||
                projectNumber > projects.Count)
            {
                return(null);
            }
            return(projects[projectNumber - 1]);
        }
Ejemplo n.º 2
0
        public static Project SelectProjectFromFilteringResult(string projectName, List <Project> projects)
        {
            Project project = null;

            if (projects.Count == 0)
            {
                Console.WriteLine(string.Format("Project \"{0}\" is not exist.", projectName));
            }
            else if (projects.Count == 1 && projects[0].Name == projectName)
            {
                project = projects[0];
            }
            else
            {
                project = ConsoleServices.SelectionProjectMenu(projects);
            }
            return(project);
        }