コード例 #1
0
        public async Task <IActionResult> GetAll([FromBody] LedgerModel ledgerModel)
        {
            ServiceResponseModel <IEnumerable <LedgerModel> > response = new ServiceResponseModel <IEnumerable <LedgerModel> >();

            try
            {
                if (string.IsNullOrWhiteSpace(ledgerModel.CompCode))
                {
                    throw new ArgumentNullException("CompCode is required");
                }
                if (string.IsNullOrWhiteSpace(ledgerModel.AccYear))
                {
                    throw new ArgumentNullException("AccYear is required");
                }
                response = await _ledgerService.GetAll(ledgerModel);

                if (response.Data == null)
                {
                    return(NotFound(response));
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.StackTrace);
                response.Success = false;
                response.Message = ex.Message;
            }
            return(Ok(response));
        }