public ListAccountsByNINResp ListAccountsByNIN(
            [FromBody] ListAccountsByNINReq listAccountsByNINReq)
        {
            if (CBNController.ValidateToken(this.Request.Headers.GetValues("Authorization").First <string>().ToString().Substring("Bearer ".Length).Trim()))
            {
                ListAccountsByNINReq listAccountsByNINReq1 = new ListAccountsByNINReq()
                {
                    NIN = listAccountsByNINReq.NIN
                };
                this.logger.Info <ListAccountsByNINReq>("Request {@value}", listAccountsByNINReq1);
                CBNIntegration.Models.ListAccountsByNIN[] array = this.cBNIntegrationData.ListAccountsByNIN(listAccountsByNINReq1).ToArray();
                int length = array.Length;
                ListAccountsByNINResp accountsByNinResp = new ListAccountsByNINResp()
                {
                    Status = this.success.ResponseCode,
                    Msg    = this.success.ResponseMessage,
                    Result = array
                };
                this.logger.Info <ListAccountsByNINResp>("Response {@value}", accountsByNinResp);
                return(accountsByNinResp);
            }
            ListAccountsByNINResp accountsByNinResp1 = new ListAccountsByNINResp()
            {
                Status = this.failed.ResponseCode,
                Msg    = this.failed.ResponseMessage
            };

            this.logger.Info <ListAccountsByNINResp>("Response {@value}", accountsByNinResp1);
            return(accountsByNinResp1);
        }
Exemple #2
0
 public List <CBNIntegration.Models.ListAccountsByNIN> ListAccountsByNIN(
     ListAccountsByNINReq listAccountsByNINReq)
 {
     try
     {
         using (OracleConnection cnn = new OracleConnection(this.connectionString))
         {
             cnn.Open();
             string sql = string.Format(File.ReadAllText(Path.Combine(Directory.GetCurrentDirectory(), this.ListAccountsByNINQry), Encoding.UTF8), (object)listAccountsByNINReq.NIN);
             List <CBNIntegration.Models.ListAccountsByNIN> list = cnn.Query <CBNIntegration.Models.ListAccountsByNIN>(sql).ToList <CBNIntegration.Models.ListAccountsByNIN>();
             cnn.Close();
             return(list);
         }
     }
     catch (Exception ex)
     {
         return(new List <CBNIntegration.Models.ListAccountsByNIN>());
     }
 }