EmployeeValidator.cs 896 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using FluentValidation;
  2. using GreenTree.Strohrmann.ERP.Domain.Model;
  3. using GreenTree.Strohrmann.ERP.Web.Models.Business;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Threading.Tasks;
  8. namespace GreenTree.Strohrmann.ERP.Web.Validators
  9. {
  10. public class EmployeeValidator : AbstractValidator<EmployeeModel>
  11. {
  12. #region DI fields
  13. // The global DbContext
  14. private readonly ERPDbContext _eRPDbContext;
  15. #endregion
  16. #region Ctor
  17. /// <summary>
  18. /// Initializes a new instance of the EmployeeValidator class
  19. /// </summary>
  20. /// <param name="eRPDbContext">Global DbContext.</param>
  21. public EmployeeValidator(
  22. ERPDbContext eRPDbContext)
  23. {
  24. _eRPDbContext = eRPDbContext;
  25. RuleFor(m => m.Firstname)
  26. .NotEmpty();
  27. RuleFor(m => m.Lastname)
  28. .NotEmpty();
  29. RuleFor(m => m.EmployeeDegree)
  30. .NotEmpty();
  31. }
  32. #endregion
  33. }
  34. }