public async Task <ActionResult <Ledger> > GetLedger(int id) { try { var result = await ledgerRepository.GetLedger(id); if (result == null) { return(NotFound()); } return(result); } catch (Exception) { return(StatusCode(StatusCodes.Status500InternalServerError, "Error retrieving data from database")); } }