using FluentValidation; using GreenTree.Strohrmann.ERP.Domain.Model; using GreenTree.Strohrmann.ERP.Web.Models.Business; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace GreenTree.Strohrmann.ERP.Web.Validators { public class EmployeeValidator : AbstractValidator { #region DI fields // The global DbContext private readonly ERPDbContext _eRPDbContext; #endregion #region Ctor /// /// Initializes a new instance of the EmployeeValidator class /// /// Global DbContext. public EmployeeValidator( ERPDbContext eRPDbContext) { _eRPDbContext = eRPDbContext; RuleFor(m => m.Firstname) .NotEmpty(); RuleFor(m => m.Lastname) .NotEmpty(); RuleFor(m => m.MailAddress) .EmailAddress() .WithMessage("Es muss eine gültige E-Mail Adresse eingegeben werden."); RuleFor(m => m.EmployeeDegree) .NotEmpty(); } #endregion } }