Esempio n. 1
0
        public void AddAppointment(AddAppointmentDto data)
        {
            var newAppointment = AutoMapper.Mapper.Map <AddAppointmentDto, Appointment>(data);

            _unitOfWork.AppointmentRepository.Add(newAppointment);
            _unitOfWork.Commit();
        }
Esempio n. 2
0
        async public Task AddAppointment(AddAppointmentDto appointment)
        {
            //var medOffice = await _medOfficeRepository.GetById(appointment.MedOfficeId);
            //SPRAWDZENIE medOffice
            // var doctor = await _userRepository.GetById(appointment.DoctorId);
            //doctor.ifUserNotExists("Error with selected doctor");
            //var medArea = DOKOŃCZYĆ

            //sprawdzić, czy w tych godzinach gabinet i lekarz są wolni
            List <Appointment> appointments = new List <Appointment>();



            appointment.Dates.ForEach(date =>
            {
                var startDate = date.AddHours(appointment.StartHour)
                                .AddMinutes(appointment.StartMinute);
                var endDate = date.AddHours(appointment.EndHour)
                              .AddMinutes(appointment.EndMinute);
                for (DateTime tempDate = startDate; tempDate <= endDate; tempDate = tempDate.AddMinutes(appointment.RangeInMinutes))
                {
                    //  tempAppointment.Doctor = (Doctor)doctor;
                    // tempAppointment.MedOffice = medOffice;

                    appointments.Add(new Appointment
                    {
                        Id   = Guid.NewGuid(),
                        Date = tempDate,
                    });;
                }
            });
        }
        public async Task <IActionResult> Post([FromBody] AddAppointmentDto appointment)
        {
            await _appointmentService.AddAppointment(appointment);

            return(Created("/appointment", null));
        }
Esempio n. 4
0
 public Task ModifyAppointment(AddAppointmentDto appointment)
 {
     throw new NotImplementedException();
 }
 public IActionResult AddAppointment([FromBody] AddAppointmentDto appointment)
 {
     _appointmentService.AddAppointment(appointment);
     return(Json(JsonResultData.Success()));
 }