예제 #1
0
        public void AddReception()
        {
            var doctors = _doctorService.GetAll();
            var i       = 0;

            foreach (var doctor in doctors)
            {
                Console.WriteLine($"Врач №{++i}");
                ShowDoctorInfo(doctor);
            }

            Console.WriteLine("Выберите врача для записи");
            var selectedDoctor = int.Parse(Console.ReadLine()) - 1;

            var patients = _patientService.GetAll();
            var j        = 0;

            foreach (var patient in patients)
            {
                Console.WriteLine($"Пациент №{++j}");
                ShowPatientInfo(patient);
            }

            Console.WriteLine("Выберите пациента для записи");
            var selectedPatient = int.Parse(Console.ReadLine()) - 1;

            Console.WriteLine("Введите дату и время приёма");
            Console.WriteLine("Введите день");
            var day = int.Parse(Console.ReadLine());

            Console.WriteLine("Введите месяц");
            var month = int.Parse(Console.ReadLine());

            Console.WriteLine("Введите год");
            var year = int.Parse(Console.ReadLine());

            Console.WriteLine("Введите часы");
            var hours = int.Parse(Console.ReadLine());

            Console.WriteLine("Введите минуты");
            var minutes = int.Parse(Console.ReadLine());

            var addedProcess = _doctorService.AddReception(new Reception
            {
                DoctorId      = doctors[selectedDoctor].Id,
                PatientId     = patients[selectedPatient].Id,
                Patient       = patients[selectedPatient],
                ReceptionTime = new DateTime(year, month, day, hours, minutes, 0),
            });

            Task.WaitAll(addedProcess);
            Console.WriteLine("Пациент успешно записан на приём");

            Console.ReadKey();
        }