SHA256
GuestLog - Localization - Initial Implementation
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using FluentValidation;
|
||||
using Somnia.GuestLog.Models.DTOs;
|
||||
using Somnia.GuestLog.Services;
|
||||
|
||||
namespace Somnia.GuestLog.Validators;
|
||||
|
||||
@@ -8,11 +9,11 @@ namespace Somnia.GuestLog.Validators;
|
||||
/// </summary>
|
||||
public class GuestDocumentDTOValidator : AbstractValidator<GuestDocumentDTO>
|
||||
{
|
||||
public GuestDocumentDTOValidator()
|
||||
public GuestDocumentDTOValidator(IDataListService dataListService)
|
||||
{
|
||||
RuleFor(x => x.DocumentType)
|
||||
.NotEmpty()
|
||||
.Must(val => val != null && GuestConsts.DocumentTypeList.Contains(val));
|
||||
.Must(val => val != null && dataListService.IsValueInList(GuestConsts.DataList_DocumentTypes, val));
|
||||
|
||||
RuleFor(x => x.DocumentNum)
|
||||
.NotEmpty()
|
||||
@@ -36,7 +37,7 @@ public class GuestDocumentDTOValidator : AbstractValidator<GuestDocumentDTO>
|
||||
|
||||
RuleFor(x => x.Nationality)
|
||||
.NotEmpty()
|
||||
.Must(val => val != null && GuestConsts.CountryList.ContainsKey(val));
|
||||
.Must(val => val != null && dataListService.IsValueInList(GuestConsts.DataList_CountryCodes, val));
|
||||
|
||||
|
||||
//Contact Fields
|
||||
@@ -50,7 +51,7 @@ public class GuestDocumentDTOValidator : AbstractValidator<GuestDocumentDTO>
|
||||
|
||||
RuleFor(x => x.AddressCountry)
|
||||
.NotEmpty()
|
||||
.Must(val => val != null && GuestConsts.CountryList.ContainsKey(val));
|
||||
.Must(val => val != null && dataListService.IsValueInList(GuestConsts.DataList_CountryCodes, val));
|
||||
|
||||
// RuleFor(x => x.Email)
|
||||
// .Cascade(CascadeMode.Stop)
|
||||
|
||||
Reference in New Issue
Block a user