Esempio n. 1
0
        public async Task <IActionResult> GetLoanDetails()
        {
            try
            {
                var response = await _loanDetailsService.GetLoanDetails();

                return(Ok(response));
            }
            catch (Exception ex)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, ex));
                // throw; // Add logger and exception filter to remove try catch
            }
        }
 public ActionResult GetLoanDetails(int loanId, int customerId)
 {
     if (loanId <= 0 && customerId <= 0)
     {
         return(BadRequest("Invalid loan id or customer id"));
     }
     if (loanId > 0 && customerId > 0)
     {
         CustomerLoan customerLoan = _loanDetailsService.GetLoanDetails(loanId, customerId);
         if (customerLoan == null)
         {
             return(NoContent());
         }
         else
         {
             return(Ok(customerLoan));
         }
     }
     else
     {
         return(NoContent());
     }
 }