Adding visited countries by robot + it stays #2
No files matched your search
@@ -8,41 +8,17 @@ namespace RobotsWantedLeague.Controllers;
|
||||
|
||||
public class RobotRequest
|
||||
{
|
||||
// [AllowedCountry(ErrorMessage = "Le pays n'est pas autorisé.")]
|
||||
// public string NewCountry { get; set; }
|
||||
|
||||
public string Country { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int Height { 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
|
||||
|
||||
@@ -7,7 +7,8 @@ public class Robot
|
||||
public int Weight { get; set; }
|
||||
public int Height { 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>();
|
||||
|
||||
|
||||
@@ -18,7 +19,6 @@ public class Robot
|
||||
this.Weight = Weight;
|
||||
this.Height = Height;
|
||||
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
|
||||
// };
|
||||
// }
|
||||
@@ -12,6 +12,16 @@
|
||||
</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;">
|
||||
|
||||
@@ -66,9 +76,7 @@
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="newCountry">Entrez le nouveau pays :</label>
|
||||
<input type="text" class="form-control" name="NewCountry" id="newCountry" placeholder="Italie">
|
||||
@* à mettre dans input du haut : data-val="true"
|
||||
<span asp-validation-for="NewCountry" class="text-danger"></span> *@
|
||||
<input type="text" class="form-control" name="NewCountry" id="newCountry" placeholder="Italie" data-val="true">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
||||
Reference in new issue
Block a user