public async Task <IActionResult> SendManifest([FromBody] CombinedSendManifestDto packageDto) { if (!packageDto.IsValid()) { return(BadRequest()); } string version = GetType().Assembly.GetName().Version.ToString(); await _mediator.Publish(new ExtractSent("CareTreatment", version)); try { if (!packageDto.SendMpi) { var result = await _dwhSendService.SendManifestAsync(packageDto.DwhPackage, _version); return(Ok(result)); } var mpiTask = await _cbsSendService.SendManifestAsync(packageDto.MpiPackage, _version); var dwhTask = await _dwhSendService.SendManifestAsync(packageDto.DwhPackage, _version); return(Ok()); } catch (Exception e) { var msg = $"Error sending Manifest {e.Message}"; Log.Error(e, msg); return(StatusCode(500, msg)); } }
public async Task <IActionResult> SendManifest([FromBody] SendManifestPackageDTO packageDTO) { if (!packageDTO.IsValid()) { return(BadRequest()); } var ver = GetType().Assembly.GetName().Version; string version = $"{ver.Major}.{ver.Minor}.{ver.Build}"; await _mediator.Publish(new ExtractSent("MasterPatientIndex", version)); try { await _cbsSendService.SendManifestAsync(packageDTO); return(Ok()); } catch (Exception e) { var msg = $"Error sending {nameof(MasterPatientIndex)} Manifest {e.Message}"; Log.Error(e, msg); return(StatusCode(500, msg)); } }
public async Task <IActionResult> SendManifest([FromBody] CombinedSendManifestDto packageDto) { if (!packageDto.IsValid()) { return(BadRequest()); } try { if (!packageDto.SendMpi) { var result = await _dwhSendService.SendManifestAsync(packageDto.DwhPackage); return(Ok(result)); } var mpiTask = _cbsSendService.SendManifestAsync(packageDto.MpiPackage); var dwhTask = await _dwhSendService.SendManifestAsync(packageDto.DwhPackage); return(Ok()); } catch (Exception e) { var msg = $"Error sending Manifest {e.Message}"; Log.Error(e, msg); return(StatusCode(500, msg)); } }
public void should_Send_Manifest() { _sendService.Client = new HttpClient(_manifestHandlerMock.Object); var sendTo = new SendManifestPackageDTO(_registry); var responses = _sendService.SendManifestAsync(sendTo, "v1").Result; Assert.NotNull(responses); Assert.False(responses.Select(x => x.IsValid()).Any(x => false)); responses.ForEach(sendManifestResponse => Log.Debug($"SENT! > {sendManifestResponse}")); }
public void should_Send_Manifest() { var sendTo = new SendManifestPackageDTO(_registry); var responses = _cbsSendService.SendManifestAsync(sendTo, _bag).Result; Assert.NotNull(responses); Assert.False(responses.Select(x => x.IsValid()).Any(x => false)); foreach (var sendManifestResponse in responses) { Console.WriteLine(sendManifestResponse); } }
public async Task <IActionResult> SendManifest([FromBody] SendManifestPackageDTO packageDTO) { if (!packageDTO.IsValid()) { return(BadRequest()); } try { await _cbsSendService.SendManifestAsync(packageDTO); return(Ok()); } catch (Exception e) { var msg = $"Error sending {nameof(MasterPatientIndex)} Manifest {e.Message}"; Log.Error(e, msg); return(StatusCode(500, msg)); } }