public async Task <IActionResult> AddHPLCTestResult(AddHPLCTestResultRequest hplcData) { _logger.LogInformation($"Invoking endpoint: {this.HttpContext.Request.GetDisplayUrl()}"); _logger.LogDebug($"Request - Add HPLC test for particular samples - {JsonConvert.SerializeObject(hplcData)}"); var rsResponse = await _centralLabService.AddHPLCTestResult(hplcData); _logger.LogInformation($"Add HPLC test for particular samples {rsResponse}"); _logger.LogDebug($"Response - Add HPLC test for particular samples - {JsonConvert.SerializeObject(rsResponse)}"); return(Ok(new AddHPLCResponse { Status = rsResponse.Status, Message = rsResponse.Message, })); }
public HPLCResultMsg AddHPLCTestResult(AddHPLCTestResultRequest hplcData) { try { var stProc = AddHPLCTestResults; var pList = new List <SqlParameter>() { new SqlParameter("@UniqueSubjectId", hplcData.subjectId ?? hplcData.subjectId), new SqlParameter("@CentralLabId", Convert.ToInt32(hplcData.centralLabId)), new SqlParameter("@HPLCTestId", hplcData.testId), new SqlParameter("@CreatedBy", Convert.ToInt32(hplcData.userId)), }; var hplcResult = UtilityDL.FillEntity <HPLCResultMsg>(stProc, pList); return(hplcResult); } catch (Exception ex) { throw ex; } }
public async Task <AddHPLCResponse> AddHPLCTestResult(AddHPLCTestResultRequest hplcData) { var hplcResponse = new AddHPLCResponse(); try { if (hplcData.centralLabId <= 0) { hplcResponse.Status = "false"; hplcResponse.Message = "Invalid central lab id"; } else if (hplcData.testId <= 0) { hplcResponse.Status = "false"; hplcResponse.Message = "invalid test id"; } else if (hplcData.subjectId == "") { hplcResponse.Status = "false"; hplcResponse.Message = "Subject Id is missing"; } else if (hplcData.userId <= 0) { hplcResponse.Status = "false"; hplcResponse.Message = "invalid user id"; } else { var msgs = _centralLabReceiptData.AddHPLCTestResult(hplcData); hplcResponse.Status = "true"; hplcResponse.Message = msgs.msg; } } catch (Exception e) { hplcResponse.Status = "false"; hplcResponse.Message = e.Message; } return(hplcResponse); }