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