add simplification steps
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
using CsharpFp1.Domain;
|
||||
|
||||
namespace CsharpFp1.Application;
|
||||
|
||||
public static class AccountApplicationService
|
||||
{
|
||||
public static void WithdrawMoney(IAccountRepository repository, Guid accountId, decimal amount)
|
||||
{
|
||||
var account =
|
||||
repository.GetById(new AccountId(accountId))
|
||||
?? throw new InvalidOperationException("Account not found.");
|
||||
|
||||
account.Withdraw(new Money(amount));
|
||||
|
||||
repository.Save(account);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user