internal void Add(Facility facility)
        {
            Console.Write("Name of the facility: ");
            facility.Name = Console.ReadLine();
            Console.Write("Name of the organization this facility is a part of: ");
            facility.Organization = Console.ReadLine();
            Console.Write("Does this facility have a former name? ");
            facility.FormerName = Console.ReadLine();
            Console.Write("Facility's web address: ");
            facility.WebAddress = Console.ReadLine();

            PopulateAddressData(facility.Address);
            PopulatePhoneData(facility.phoneNumbers);

            FacilityRepo repo = new FacilityRepo();

            repo.Add(facility);

            Console.WriteLine("\nAdded new facility.");
        }
示例#2
0
        protected void ProcessFacility(Event evt)
        {
            FacilityRepo    _repo       = new FacilityRepo();
            List <Facility> _facilities = _repo.GetAll().Cast <Facility>().ToList();
            int             _count      = _facilities.Count();

            Console.WriteLine();

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

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

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

                if (_option == _count + 1)
                {
                    FacilityView _fv = new FacilityView();
                    _fv.Add(evt.Facility);
                }
                else
                {
                    --_option;                                      // Decrement _option to accommodate zero-based indexing
                    evt.Facility = _facilities[_option];
                }
            }
            else
            {
                FacilityView _fv = new FacilityView();
                _fv.Add(evt.Facility);
            }
        }
 public FacilityController()
 {
     _sRepo = new FacilityRepo();
 }