public AccountDetailsResp AccountDetails([FromBody] CBNIntegration.Models.AccountDetails accountDetails) { if (CBNController.ValidateToken(this.Request.Headers.GetValues("Authorization").First <string>().ToString().Substring("Bearer ".Length).Trim())) { AccountDetailsReq accountDetailsReq = new AccountDetailsReq() { AccountNo = accountDetails.ACCOUNTNO }; this.logger.Info <AccountDetailsReq>("Request {@value}", accountDetailsReq); CBNIntegration.Models.AccountDetails[] array = this.cBNIntegrationData.AccountDetails(accountDetailsReq).ToArray(); int length = array.Length; AccountDetailsResp accountDetailsResp = new AccountDetailsResp() { Status = this.success.ResponseCode, Msg = this.success.ResponseMessage, Result = array }; this.logger.Info <AccountDetailsResp>("Response {@value}", accountDetailsResp); return(accountDetailsResp); } AccountDetailsResp accountDetailsResp1 = new AccountDetailsResp() { Status = this.failed.ResponseCode, Msg = this.failed.ResponseMessage }; this.logger.Info <AccountDetailsResp>("Response {@value}", accountDetailsResp1); return(accountDetailsResp1); }
public List <CBNIntegration.Models.AccountDetails> AccountDetails( AccountDetailsReq accountDetailsReq) { try { using (OracleConnection cnn = new OracleConnection(this.connectionString)) { cnn.Open(); string sql = string.Format(File.ReadAllText(Path.Combine(Directory.GetCurrentDirectory(), this.AccountDetailsQry), Encoding.UTF8), (object)accountDetailsReq.AccountNo); List <CBNIntegration.Models.AccountDetails> list = cnn.Query <CBNIntegration.Models.AccountDetails>(sql).ToList <CBNIntegration.Models.AccountDetails>(); cnn.Close(); return(list); } } catch (Exception ex) { return(new List <CBNIntegration.Models.AccountDetails>()); } }