public async Task <IActionResult> UpdateLMP(UpdateLMPRequest rData) { _logger.LogInformation($"Invoking endpoint: {this.HttpContext.Request.GetDisplayUrl()}"); _logger.LogDebug($"Updating the LMP - {JsonConvert.SerializeObject(rData)}"); var subjectSample = await _supportService.UpdateLMP(rData); return(Ok(new ServiceResponse { Status = subjectSample.Status, Message = subjectSample.Message, })); }
public async Task <ServiceResponse> UpdateLMP(UpdateLMPRequest rData) { ServiceResponse sResponse = new ServiceResponse(); try { if (string.IsNullOrEmpty(rData.subjectId)) { sResponse.Status = "false"; sResponse.Message = "SubjectID is missing"; return(sResponse); } else if (string.IsNullOrEmpty(rData.oldLMP)) { sResponse.Status = "false"; sResponse.Message = "Current LMP is missing"; return(sResponse); } else if (string.IsNullOrEmpty(rData.newLMP)) { sResponse.Status = "false"; sResponse.Message = "Revised LMP is missing"; return(sResponse); } else if (string.IsNullOrEmpty(rData.remarks)) { sResponse.Status = "false"; sResponse.Message = "Remarks is missing"; return(sResponse); } else if (rData.userId <= 0) { sResponse.Status = "false"; sResponse.Message = "Invalid UserId"; return(sResponse); } else { var result = _supportData.UpdateErrorLMP(rData); EmailLMPTrigger(rData.subjectId, rData.oldLMP, rData.newLMP); sResponse.Status = "true"; sResponse.Message = result.msg; return(sResponse); } } catch (Exception e) { sResponse.Status = "false"; sResponse.Message = e.Message; return(sResponse); } }
public ErrorMsgDetail UpdateErrorLMP(UpdateLMPRequest bData) { string stProc = UpdateLMPDetail; var pList = new List <SqlParameter>() { new SqlParameter("@SubjectId", bData.subjectId), new SqlParameter("@OldLMP", bData.oldLMP), new SqlParameter("@NewLMP", bData.newLMP), new SqlParameter("@Remarks", bData.remarks), new SqlParameter("@UserId", bData.userId), }; var allData = UtilityDL.FillEntity <ErrorMsgDetail>(stProc, pList); return(allData); }