first commit
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Landmark.OLA.Models.Individuals.Enums;
|
||||
|
||||
namespace Landmark.OLA.Models.HomeMortgageDisclosureAct
|
||||
{
|
||||
public class Hmda
|
||||
{
|
||||
public ICollection<Race> Races { get; set; }
|
||||
|
||||
[StringLength(100)]
|
||||
public string AmericanIndianAlaskaNativeTribe { get; set; }
|
||||
|
||||
[StringLength(100)]
|
||||
public string OtherAsianRace { get; set; }
|
||||
|
||||
[StringLength(100)]
|
||||
public string OtherPacificIslanderRace { get; set; }
|
||||
|
||||
public ICollection<Ethnicity> Ethnicities { get; set; }
|
||||
|
||||
[StringLength(100)]
|
||||
public string OtherHispanicLatinoEthnicity { get; set; }
|
||||
|
||||
public List<Sex> Sexes { get; set; }
|
||||
|
||||
public bool? HmdaNoticeDisclosed { get; set; }
|
||||
|
||||
public Hmda()
|
||||
{
|
||||
Races = [];
|
||||
Ethnicities = [];
|
||||
Sexes = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
using FluentValidation;
|
||||
using Landmark.OLA.Models.Individuals.Enums;
|
||||
|
||||
namespace Landmark.OLA.Models.HomeMortgageDisclosureAct.Validators
|
||||
{
|
||||
public class HmdaValidator : AbstractValidator<Hmda>
|
||||
{
|
||||
public HmdaValidator()
|
||||
{
|
||||
RuleFor(x => x.Races).NotEmpty()
|
||||
.WithMessage($"No race information was provided. Set {Race.NotProvided} if none will be provided.");
|
||||
RuleFor(x => x.Races).Must(races => races.Contains(Race.AmericanIndianAlaskaNative))
|
||||
.When(x => !string.IsNullOrWhiteSpace(x.AmericanIndianAlaskaNativeTribe))
|
||||
.WithMessage($"Include {Race.AmericanIndianAlaskaNative} in Races when a value is set in AmericanIndianAlaskaNativeTribe.");
|
||||
RuleFor(x => x.Races).Must(races => races.Contains(Race.OtherAsian))
|
||||
.When(x => !string.IsNullOrWhiteSpace(x.OtherAsianRace))
|
||||
.WithMessage($"Include {Race.OtherAsian} in Races when a value is set in OtherAsianRace.");
|
||||
RuleFor(x => x.Races).Must(races => races.Contains(Race.OtherPacificIslander))
|
||||
.When(x => !string.IsNullOrWhiteSpace(x.OtherPacificIslanderRace))
|
||||
.WithMessage($"Include {Race.OtherPacificIslander} in Races when a value is set in OtherPacificIslanderRace.");
|
||||
|
||||
RuleFor(x => x.Ethnicities).NotEmpty()
|
||||
.WithMessage($"No ethnicity information was provided. Set {Ethnicity.NotProvided} if none will be provided.");
|
||||
RuleFor(x => x.Ethnicities).Must(ethnicities => ethnicities.Contains(Ethnicity.OtherHispanicLatino))
|
||||
.When(x => !string.IsNullOrWhiteSpace(x.OtherHispanicLatinoEthnicity))
|
||||
.WithMessage($"Include {Ethnicity.OtherHispanicLatino} in Ethnicities when a value is set in OtherHispanicLatinoEthnicity.");
|
||||
|
||||
RuleFor(x => x.Sexes).NotEmpty()
|
||||
.WithMessage($"No sex information was provided. Set {Sex.NotProvided} if none will be provided.");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user