Example #1
0
 public async Task <ActionResult <CreditLoanRespObj> > GetAllCreditLoan()
 {
     try
     {
         var response = _repo.GetAllCreditLoan();
         return(Ok(new CreditLoanRespObj
         {
             Loans = _mapper.Map <List <credit_loan_obj> >(response),
             Status = new APIResponseStatus
             {
                 IsSuccessful = true,
                 Message = new APIResponseMessage {
                     FriendlyMessage = response.Count() > 0 ? "Search record found" : "No record found"
                 }
             },
         }));
     }
     catch (Exception ex)
     {
         var errorCode = ErrorID.Generate(5);
         _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");
         return(new CreditLoanRespObj
         {
             Status = new APIResponseStatus {
                 IsSuccessful = false, Message = new APIResponseMessage {
                     FriendlyMessage = "Error Occurred", TechnicalMessage = ex?.Message, MessageId = errorCode
                 }
             }
         });
     }
 }