Adding visited countries by robot + it stays #2

Closed
marcdescotes wants to merge 7 commits from main into main
pull from: main
4 changed files with 14 additions and 40 deletions
Showing only changes of commit 9052c11194 - Show all commits

No files matched your search

@@ -8,41 +8,17 @@ namespace RobotsWantedLeague.Controllers;
public class RobotRequest public class RobotRequest
{ {
// [AllowedCountry(ErrorMessage = "Le pays n'est pas autorisé.")]
// public string NewCountry { get; set; }
public string Country { get; set; } public string Country { get; set; }
public string Name { get; set; } public string Name { get; set; }
public int Height { get; set; } public int Height { get; set; }
public int Weight { get; set; } public int Weight { get; set; }
// public static readonly List<string> AllowedCountries = new List<string>
// {
// "Canada",
// "United States of America",
// "Mexico",
// };
} }
// public class AllowedCountryAttribute : ValidationAttribute
// {
// protected override ValidationResult IsValid(object value, ValidationContext validationContext)
// {
// string country = value as string;
// if (string.IsNullOrEmpty(country))
// {
// return ValidationResult.Success;
// }
// if (!CountryConstants.AllowedCountries.Contains(country, StringComparer.OrdinalIgnoreCase))
// {
// return new ValidationResult(ErrorMessage);
// }
// return ValidationResult.Success;
// }
// }
public class RobotsController : Controller public class RobotsController : Controller
+2 -2
View File
@@ -7,7 +7,8 @@ public class Robot
public int Weight { get; set; } public int Weight { get; set; }
public int Height { get; set; } public int Height { get; set; }
public string Country { get; set; } public string Country { get; set; }
// public string NewCountry { get; set; }
public string NewCountry { get; set; }
public List<string> VisitedCountries { get; set; } = new List<string>(); public List<string> VisitedCountries { get; set; } = new List<string>();
@@ -18,7 +19,6 @@ public class Robot
this.Weight = Weight; this.Weight = Weight;
this.Height = Height; this.Height = Height;
this.Country = Country; this.Country = Country;
// this.NewCountry = NewCountry;
} }
@@ -1,10 +0,0 @@
// public static class CountryConstants
// {
// public static readonly List<string> AllowedCountries = new List<string>
// {
// "Canada",
// "United States of America",
// "Mexico",
// // Ajoutez les 7 autres pays autorisés ici
// };
// }
+11 -3
View File
@@ -12,6 +12,16 @@
</div> </div>
</div> </div>
@* <div class="container">
<div class="d-flex justify-content-center">
<div class="card mb-3" style="width: 10rem;">
<iframe class="card-img-top" src="https://good-hawk-21.deno.dev/ljl"></iframe>
</div>
</div>
</div> *@
<table class="table table-hover" style="width: 40%; margin-left: auto; margin-right: auto;"> <table class="table table-hover" style="width: 40%; margin-left: auto; margin-right: auto;">
@@ -66,9 +76,7 @@
<div class="modal-body"> <div class="modal-body">
<div class="form-group"> <div class="form-group">
<label for="newCountry">Entrez le nouveau pays :</label> <label for="newCountry">Entrez le nouveau pays :</label>
<input type="text" class="form-control" name="NewCountry" id="newCountry" placeholder="Italie"> <input type="text" class="form-control" name="NewCountry" id="newCountry" placeholder="Italie" data-val="true">
@* à mettre dans input du haut : data-val="true"
<span asp-validation-for="NewCountry" class="text-danger"></span> *@
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">