protected override async Task <Unit> HandleValidatedCommand(AddFinancialYearCommand command) { if (command.PreviousFinancialYearId.HasValue) { // TODO Get end balance of the previous financial year, for each account, and use it as starting balance } await _repository.AddFinancialYear(command.Id, command.Name); return(Unit.Value); }
protected override async Task <Unit> HandleValidatedCommand(AddFinancialYearCommand command) { if (command.PreviousFinancialYearId.HasValue) { await _accountRepository.SetupAccountBalancesForNewFinancialYear( closingFinancialYear : command.PreviousFinancialYearId.Value, newFinancialYearId : command.Id); } await _financialYearRepository.AddFinancialYear(command.Id, command.Name); return(Unit.Value); }