15 lines
628 B
C#
15 lines
628 B
C#
|
|
namespace FrontOffice.BFF.Application.UserWalletCQ.Commands.TransferUserWalletBallance;
|
||
|
|
public class TransferUserWalletBallanceCommandValidator : AbstractValidator<Unit>
|
||
|
|
{
|
||
|
|
public TransferUserWalletBallanceCommandValidator()
|
||
|
|
{
|
||
|
|
}
|
||
|
|
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||
|
|
{
|
||
|
|
var result = await ValidateAsync(ValidationContext<Unit>.CreateWithOptions((Unit)model, x => x.IncludeProperties(propertyName)));
|
||
|
|
if (result.IsValid)
|
||
|
|
return Array.Empty<string>();
|
||
|
|
return result.Errors.Select(e => e.ErrorMessage);
|
||
|
|
};
|
||
|
|
}
|