Exemplo n.º 1
0
        public async Task <IActionResult> AddAppointment([FromBody] AppointmentToAddDto appointmentToAddDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var appointmentToCreate = new Appointment
            {
                startDate       = appointmentToAddDto.startDate,
                endDate         = appointmentToAddDto.endDate,
                allDay          = appointmentToAddDto.allDay,
                text            = appointmentToAddDto.text,
                description     = appointmentToAddDto.description,
                patientName     = appointmentToAddDto.patientName,
                patientSurname  = appointmentToAddDto.patientSurname,
                patientaddress  = appointmentToAddDto.patientaddress,
                patientpesel    = appointmentToAddDto.patientpesel,
                specialization  = appointmentToAddDto.specialization,
                NameOfTreatment = appointmentToAddDto.NameOfTreatment,
                doctor          = appointmentToAddDto.doctor,
                price           = appointmentToAddDto.price,
                paid            = appointmentToAddDto.paid
            };

            await _repo.AddAppointment(appointmentToCreate);

            return(StatusCode(201));
        }