public async Task <IActionResult> GetByCode([FromBody] LedgerModel editLedgerModel) { ServiceResponseModel <IEnumerable <LedgerModel> > response = new ServiceResponseModel <IEnumerable <LedgerModel> >(); try { if (string.IsNullOrWhiteSpace(editLedgerModel.CompCode)) { throw new ArgumentNullException("CompCode is required"); } if (string.IsNullOrWhiteSpace(editLedgerModel.AccYear)) { throw new ArgumentNullException("AccYear is required"); } if (string.IsNullOrWhiteSpace(editLedgerModel.AccountId)) { throw new ArgumentNullException("AccountId is required"); } response = await _ledgerService.GetByCode(editLedgerModel); if (response.Data == null) { return(NotFound(response)); } } catch (Exception ex) { _logger.LogError(ex.StackTrace); response.Success = false; response.Message = ex.Message; } return(Ok(response)); }