示例#1
0
        public async Task <IActionResult> Edit([FromBody] LedgerModel editLedgerModel)
        {
            ServiceResponseModel <LedgerModel> response = new ServiceResponseModel <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.VouNo))
                {
                    throw new ArgumentNullException("VouNo is required");
                }
                if (editLedgerModel.ItemSr < 0)
                {
                    throw new ArgumentNullException("ItemSr is required");
                }
                response = await _ledgerService.Edit(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));
        }