| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- 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<EmployeeModel>
- {
- #region DI fields
- // The global DbContext
- private readonly ERPDbContext _eRPDbContext;
- #endregion
- #region Ctor
- /// <summary>
- /// Initializes a new instance of the EmployeeValidator class
- /// </summary>
- /// <param name="eRPDbContext">Global DbContext.</param>
- 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
- }
- }
|