refactorrr

This commit is contained in:
2024-09-23 22:13:11 +03:00
parent abfa75247d
commit e8fd8523aa
14 changed files with 47 additions and 15 deletions

View File

@@ -0,0 +1,18 @@
using System.ComponentModel.DataAnnotations;
namespace BlazorWebAssemblyVisaApiClient.Validation.Applicants.Models
{
public enum MaritalStatusModel
{
Other = 0,
Married = 1,
Unmarried = 2,
Separated = 3,
[Display(Name = "Widow or widower")]
WidowOrWidower = 4
}
}

View File

@@ -45,7 +45,7 @@ public class RegisterApplicantRequestModel
[Required(AllowEmptyStrings = true)]
[JsonConverter(typeof(StringEnumConverter))]
public MaritalStatus MaritalStatus { get; set; }
public MaritalStatusModel MaritalStatus { get; set; }
[Required]
[ValidateComplexType]
@@ -64,4 +64,4 @@ public class RegisterApplicantRequestModel
public PlaceOfWorkModel PlaceOfWork { get; set; } = new();
public bool IsNonResident { get; set; }
}
}

View File

@@ -14,7 +14,7 @@ public class VisaApplicationCreateRequestModel
public string DestinationCountry { get; set; } = default!;
[Required]
public VisaCategory VisaCategory { get; set; }
public VisaCategoryModel VisaCategory { get; set; }
[Required]
public bool IsForGroup { get; set; }
@@ -34,4 +34,4 @@ public class VisaApplicationCreateRequestModel
[ValidateComplexType]
public List<PastVisitModel> PastVisits { get; set; } = [];
}
}

View File

@@ -0,0 +1,11 @@
using System.ComponentModel.DataAnnotations;
namespace BlazorWebAssemblyVisaApiClient.Validation.VisaApplications.Models
{
public enum VisaCategoryModel
{
Transit = 0,
[Display(Name = "Short dated")]
ShortDated = 1
}
}

View File

@@ -18,7 +18,7 @@ public class VisaApplicationCreateRequestValidator : AbstractValidator<VisaAppli
.NotEmpty()
.WithMessage("For transit you must provide permission to destination country")
.SetValidator(permissionToDestCountryModelValidator)
.When(r => r.VisaCategory is VisaCategory.Transit);
.When(r => r.VisaCategory is VisaCategoryModel.Transit);
RuleFor(r => r.ReentryPermit)
.NotEmpty()