-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
132 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using Neptuo; | ||
using Neptuo.Commands; | ||
using Neptuo.Models.Keys; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Money.Commands | ||
{ | ||
/// <summary> | ||
/// Changes an <see cref="Amount"/> of the income with <see cref="IncomeKey"/>. | ||
/// </summary> | ||
public class ChangeIncomeAmount : Command | ||
{ | ||
/// <summary> | ||
/// Gets a key of the income to modify. | ||
/// </summary> | ||
public IKey IncomeKey { get; private set; } | ||
|
||
/// <summary> | ||
/// Gets a new income value. | ||
/// </summary> | ||
public Price Amount { get; private set; } | ||
|
||
/// <summary> | ||
/// Changes an <paramref name="amount"/> of the income with <paramref name="key"/>. | ||
/// </summary> | ||
/// <param name="incomeKey">A key of the income to modify.</param> | ||
/// <param name="amount">A new income value.</param> | ||
public ChangeIncomeAmount(IKey incomeKey, Price amount) | ||
{ | ||
Ensure.Condition.NotEmptyKey(incomeKey); | ||
Ensure.NotNull(amount, "amount"); | ||
IncomeKey = incomeKey; | ||
Amount = amount; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Money.Events | ||
{ | ||
/// <summary> | ||
/// An event raised when an amount of income has changed. | ||
/// </summary> | ||
public class IncomeAmountChanged : UserEvent | ||
{ | ||
/// <summary> | ||
/// Gets an original value of the income. | ||
/// </summary> | ||
public Price OldValue { get; private set; } | ||
|
||
/// <summary> | ||
/// Gets a new value of the income. | ||
/// </summary> | ||
public Price NewValue { get; private set; } | ||
|
||
internal IncomeAmountChanged(Price oldValue, Price newValue) | ||
{ | ||
OldValue = oldValue; | ||
NewValue = newValue; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Neptuo.Models; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Money | ||
{ | ||
/// <summary> | ||
/// An exception raised when trying to modify an income that is already deleted. | ||
/// </summary> | ||
public class IncomeAlreadyDeletedException : AggregateRootException | ||
{ } | ||
} |