using FluentValidation; using GreenTree.Nachtragsmanagement.Web.Models.Deviation; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace GreenTree.Nachtragsmanagement.Web.Validation.Admin.User { public class DeviationDataModelValidator : AbstractValidator { public DeviationDataModelValidator() { RuleFor(m => m.CustomNumber) .NotEmpty() .WithMessage("Nummer wird benötigt") .MaximumLength(10) .WithMessage("Muss unter 10 Zeichen sein"); RuleFor(m => m.Description) .NotEmpty() .WithMessage("Beschreibung wird benötigt"); RuleFor(m => m.ReceiptDate) .NotEmpty() .WithMessage("Einreichdatum wird benötigt"); RuleFor(m => m.Value) .NotEmpty() .WithMessage("Eine Schätzung wird benötigt"); RuleFor(m => m.Percentage) .NotEmpty() .WithMessage("Eine Bewertung wird benötigt"); RuleFor(m => m.StatusId) .NotEmpty() .WithMessage("Ein Status muss gewählt werden"); RuleFor(m => m.DisturbanceEntities) .Must(r => r.Count > 0) .WithMessage("Eine Kategorie muss ausgewählt werden"); RuleFor(m => m.KindId) .NotEmpty() .WithMessage("Eine Art muss gewählt werden"); RuleFor(m => m.Comment) .NotEmpty() .WithMessage("Ein Kommentar wird benötigt"); } } }