Exemplo n.º 1
0
        private int List()
        {
            List <Physician> _physicians = _pr.GetAll().Cast <Physician>().ToList();
            int _count = _physicians.Count();
            int _num   = 0;

            Console.WriteLine();

            if (_count > 0)
            {
                foreach (var item in _physicians)
                {
                    Console.WriteLine($"  {++_num}  {item}");
                }
            }
            else
            {
                Console.WriteLine("No physicians found.");
            }

            return(_count);
        }
Exemplo n.º 2
0
        protected void ProcessPhysician(Event evt)
        {
            PhysicianRepo    _repo    = new PhysicianRepo();
            List <Physician> _doctors = _repo.GetAll().Cast <Physician>().ToList();
            int _count = _doctors.Count();

            Console.WriteLine();

            if (_count > 0)
            {
                for (int i = 0; i < _count; i++)
                {
                    Console.WriteLine($"{i + 1} {_doctors[i]}");
                }

                Console.WriteLine($"{_count + 1} Add a physician");
                Console.WriteLine();

                int _option = GetOption("Please enter your selection: ", _count + 1);

                if (_option == _count + 1)
                {
                    PhysicianView _pv = new PhysicianView();
                    _pv.Add(evt.Physician);
                }
                else
                {
                    --_option;                                      // Decrement _option to accommodate zero-based indexing
                    evt.Physician = _doctors[_option];
                }
            }
            else
            {
                PhysicianView _pv = new PhysicianView();
                _pv.Add(evt.Physician);
            }
        }