From 9052c1119483facd389273b2d27a8137edc1ddef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Desc=C3=B4teaux?= <125318411+marcdescotes@users.noreply.github.com> Date: Thu, 21 Sep 2023 10:04:28 -0400 Subject: [PATCH] Deleted stuff from validation branch --- .../Controllers/RobotsController.cs | 28 ++----------------- RobotsWantedLeague/Models/Robot.cs | 4 +-- .../Services/CountryConstants.cs | 10 ------- RobotsWantedLeague/Views/Robots/Robot.cshtml | 14 ++++++++-- 4 files changed, 15 insertions(+), 41 deletions(-) delete mode 100644 RobotsWantedLeague/Services/CountryConstants.cs diff --git a/RobotsWantedLeague/Controllers/RobotsController.cs b/RobotsWantedLeague/Controllers/RobotsController.cs index c408ef9..fbb9aa2 100644 --- a/RobotsWantedLeague/Controllers/RobotsController.cs +++ b/RobotsWantedLeague/Controllers/RobotsController.cs @@ -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 AllowedCountries = new List -// { -// "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 diff --git a/RobotsWantedLeague/Models/Robot.cs b/RobotsWantedLeague/Models/Robot.cs index e76a8d6..786cb39 100644 --- a/RobotsWantedLeague/Models/Robot.cs +++ b/RobotsWantedLeague/Models/Robot.cs @@ -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 VisitedCountries { get; set; } = new List(); @@ -18,7 +19,6 @@ public class Robot this.Weight = Weight; this.Height = Height; this.Country = Country; - // this.NewCountry = NewCountry; } diff --git a/RobotsWantedLeague/Services/CountryConstants.cs b/RobotsWantedLeague/Services/CountryConstants.cs deleted file mode 100644 index 5107611..0000000 --- a/RobotsWantedLeague/Services/CountryConstants.cs +++ /dev/null @@ -1,10 +0,0 @@ -// public static class CountryConstants -// { -// public static readonly List AllowedCountries = new List -// { -// "Canada", -// "United States of America", -// "Mexico", -// // Ajoutez les 7 autres pays autorisés ici -// }; -// } \ No newline at end of file diff --git a/RobotsWantedLeague/Views/Robots/Robot.cshtml b/RobotsWantedLeague/Views/Robots/Robot.cshtml index db84651..aaee6d1 100644 --- a/RobotsWantedLeague/Views/Robots/Robot.cshtml +++ b/RobotsWantedLeague/Views/Robots/Robot.cshtml @@ -12,6 +12,16 @@ +@*
+
+
+ +
+
+
*@ + + + @@ -66,9 +76,7 @@