using System.ComponentModel.DataAnnotations;
namespace Dlhis.Canteen.Order.Request;
public class BalanceSupplementRequest : IValidatableObject
{
///
/// 流水号
///
[Required(ErrorMessage = "流水号")]
public string No { get; set; }
///
/// 事由
///
[Required(ErrorMessage = "事由")]
public string Reason { get; set; }
///
/// 补金额数
///
public decimal Amount { get; set; }
public IEnumerable Validate(ValidationContext validationContext)
{
//if (Amount > 0)
//{
// yield return new ValidationResult("金额有误", new[] { nameof(Amount) });
//}
//都是消费处理
Amount = -Math.Abs(Amount);
yield break;
}
}