public async Task <IActionResult> CreateAppointment(int patientId, [FromBody] AppointmentForCreationDto appointmentForCreation) { if (appointmentForCreation == null) { ModelState.AddModelError("Message", "Unable to locate payload for new appointment"); return(BadRequest(ModelState)); } var command = new AddAppointmentCommand(patientId, appointmentForCreation.AppointmentDate, appointmentForCreation.Reason); _logger.LogInformation( $"----- Sending command: AddAppointmentCommand - {command.PatientId} - {command.AppointmentDate}"); var commandResult = await _mediator.Send(command); if (commandResult == null) { return(BadRequest("Command not created")); } return(CreatedAtAction("GetAppointmentByIdentifier", new { patientId, id = commandResult.Id }, commandResult)); }
public override void OnNavigatedTo(NavigationContext navigationContext) { IsEditMode = navigationContext.Parameters.Count() != 0; if (IsEditMode) { Guid patietnId = Guid.Parse((string)navigationContext.Parameters[NavigationParams.PATIENT_ID_PARAM]); SetPatientModel(_patientService.GetPatientById(patietnId)); } else { SetPatientModel(new Patient()); } OnPropertyChanged(() => IsEditMode); PatientModel.ForceValidation(); AddAppointmentCommand.RaiseCanExecuteChanged(); SavePatientDataCommand.RaiseCanExecuteChanged(); AttachEvents(); }
public void AddExaminationRoom([FromBody] AddAppointmentCommand appointmentCommand) { addAppointmentCommandHandler.Handle(appointmentCommand); }