Files
FrontOffice.BFF/src/FrontOffice.BFF.Application/UserWalletCQ/Commands/TransferUserWalletBallance/TransferUserWalletBallanceCommandValidator.cs

15 lines
628 B
C#
Raw Normal View History

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);
};
}