Cats.Areas.Logistics.Models.DispatchViewModelForReconcile.Validate C# (CSharp) Method

Validate() public method

public Validate ( System.ComponentModel.DataAnnotations.ValidationContext validationContext ) : IEnumerable
validationContext System.ComponentModel.DataAnnotations.ValidationContext
return IEnumerable
        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        {
            if (Quantity < ReceivedAmount)
            {
                yield return new ValidationResult("Received amount can not be greater than Dispatched amount!");
            }
            if(Quantity < LossAmount)
            {
                yield return new ValidationResult("Loss Amount can not be greater than Dispatched amount");
            }
            if (LossAmount > 0)
            {
                if (Quantity < (ReceivedAmount + LossAmount))
                {
                    yield return
                        new ValidationResult(
                            "The sum of loss amount and received amount can not be greater than dispatched amount");
                }
            }
        }
DispatchViewModelForReconcile