public IActionResult TrainBtwnStations([FromBodyAttribute] TrainBtwnStnsRequest Request) { ErrorResponse error = new ErrorResponse(); if (!ModelState.IsValid || string.IsNullOrEmpty(Request.request.enquiryForDate) || string.IsNullOrEmpty(Request.request.trainTo) || string.IsNullOrEmpty(Request.request.trainFrom)) { return(Ok(new Application_ResponseWrapper() { ResponseCode = "1000", ResponseMessage = "Invalid model", Status = "failed", ResponseResult = "" })); } if (string.IsNullOrEmpty(_irctcUrl) || string.IsNullOrEmpty(_irctc_userName) || string.IsNullOrEmpty(_irctc_password)) { return(Ok(new Application_ResponseWrapper() { ResponseCode = "1001", ResponseMessage = "No IRCTC configuration found", Status = "failed" })); } _irctcUrl = _irctcUrl + "taenqservices/tatwnstns"; try { CommunicationLog("OxiRail", "trainBtwnStation OUT->>" + JsonConvert.SerializeObject(Request).ToString(), Request.userSession); TrainBetweenStationResponse Response = new TrainBetweenStationResponse(); var response = _booking.FindTrainBtwnStation(_irctcUrl, Request.request, Request.userSession, _authInfo); try{ Response = (TrainBetweenStationResponse)JsonConvert.DeserializeObject(response.ToString(), typeof(TrainBetweenStationResponse)); } catch (Exception e) { Response = (TrainBetweenStationResponse)JsonConvert.DeserializeObject(response.ToString(), typeof(TrainBetweenStationResponse)); } if (Response.quotaList != null) { CommunicationLog("OxiRail", "trainBtwnStation IN->>" + JsonConvert.SerializeObject(Response).ToString(), Request.userSession); return(Ok(new Application_ResponseWrapper() { ResponseCode = "0", ResponseMessage = "success", Status = "success", ResponseResult = Response })); } else { error = (ErrorResponse)JsonConvert.DeserializeObject(response.ToString(), typeof(ErrorResponse)); CommunicationLog("OxiRail", "trainBtwnStation IN->>" + JsonConvert.SerializeObject(error).ToString(), Request.userSession); return(Ok(new Application_ResponseWrapper() { ResponseCode = "1000", ResponseMessage = error.errorMessage, Status = "Error", ResponseResult = "" })); } } catch (Exception e) { CommunicationLog("OxiRail", e.ToString(), Request.userSession); error.Dispose(); return(Ok(new Application_ResponseWrapper() { ResponseCode = "1000", ResponseMessage = "Api_Error or IRCTC Service Down", Status = "Error", ResponseResult = e })); } }