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