コード例 #1
0
        public async Task <ActionResult <Appointment> > CreateAppointment(a.AppointmentResource appointment)
        {
            var appointmentResuource = _mapper.Map <a.AppointmentResource, Appointment>(appointment);
            var result = await _appointmentService.CreateAppointment(appointmentResuource);

            //if (result != null)
            //{
            //    TransactionSetup transactionSetup = new TransactionSetup();
            //    transactionSetup.TransactionStatus = Status.Start;
            //    transactionSetup.EventRaised = true;
            //    transactionSetup.AppoitmentId = result.Id;
            //    await _logService.CreateLog(transactionSetup);
            //    if (!_amqService.SendEvent(transactionSetup, EVENT_NAME_STATUS))
            //    {
            //        transactionSetup.EventRaised = false;
            //        var id = new Guid(result.Id.ToString());
            //        var log = await _logService.GetLogByAppoitmentId(id);
            //        await _logService.UpdateLog(transactionSetup, log);
            //    }

            //}

            return(Ok(result));
        }
コード例 #2
0
        public async Task <ActionResult <Appointment> > UpdateAppointment(Guid doctorId, Guid patientId, [FromBody] a.AppointmentResource saveAppointment)
        {
            var appointmentToBeUpdate = await _appointmentService.GetAppointmentForDoctorAndPatient(doctorId, patientId);

            if (appointmentToBeUpdate == null)
            {
                return(NotFound());
            }

            var appointmentResuource = _mapper.Map <a.AppointmentResource, Appointment>(saveAppointment);

            await _appointmentService.UpdateAppointment(appointmentToBeUpdate, appointmentResuource);

            var updatedAppointment = await _appointmentService.GetAppointmentForDoctorAndPatient(doctorId, patientId);

            return(Ok(updatedAppointment));
        }