From 7594d179a82d4a36c8cbe6f01453317045df50e8 Mon Sep 17 00:00:00 2001 From: wozniak Date: Sun, 22 Mar 2026 16:28:01 +0100 Subject: [PATCH] adding some views --- .../Controllers/PointsOfInterestController.cs | 10 +- CityInfo.WEB/Components/Loading.razor | 8 ++ CityInfo.WEB/Components/PageHeader.razor | 28 +++-- CityInfo.WEB/Components/PageHeader.razor.cs | 9 +- CityInfo.WEB/Layout/NavMenu.razor | 2 +- CityInfo.WEB/Models/City.cs | 1 - CityInfo.WEB/Pages/CitiesOverview.razor | 23 ++-- CityInfo.WEB/Pages/CityDetails.razor | 53 +++++++++ CityInfo.WEB/Pages/CityDetails.razor.cs | 31 +++++ CityInfo.WEB/Pages/NotFound.razor | 77 ++++++++++++- .../Pages/PointsOfInterestOverview.razor | 7 -- .../Pages/PointsOfInterestOverview.razor.cs | 20 ---- CityInfo.WEB/Services/CityDataService.cs | 108 ++++++++++++++---- CityInfo.WEB/Services/ICityDataService.cs | 8 +- .../Services/IPointOfInterestDataService.cs | 8 +- .../Services/PointOfInterestDataService.cs | 26 +++-- 16 files changed, 327 insertions(+), 92 deletions(-) create mode 100644 CityInfo.WEB/Components/Loading.razor create mode 100644 CityInfo.WEB/Pages/CityDetails.razor create mode 100644 CityInfo.WEB/Pages/CityDetails.razor.cs delete mode 100644 CityInfo.WEB/Pages/PointsOfInterestOverview.razor delete mode 100644 CityInfo.WEB/Pages/PointsOfInterestOverview.razor.cs diff --git a/CityInfo.API/Controllers/PointsOfInterestController.cs b/CityInfo.API/Controllers/PointsOfInterestController.cs index 00672fa..97de9f1 100644 --- a/CityInfo.API/Controllers/PointsOfInterestController.cs +++ b/CityInfo.API/Controllers/PointsOfInterestController.cs @@ -36,11 +36,11 @@ namespace CityInfo.API.Controllers try { //throw new Exception("caca prout"); - var cityName = User.Claims.FirstOrDefault(claim => claim.Type == "city")?.Value; - if (!await _cityInfoRepository.CityNameMatchesCityId(cityName, cityId)) - { - return Forbid(); - } + //var cityName = User.Claims.FirstOrDefault(claim => claim.Type == "city")?.Value; + //if (!await _cityInfoRepository.CityNameMatchesCityId(cityName, cityId)) + //{ + // return Forbid(); + //} if(!await _cityInfoRepository.CityExistAsync(cityId)) { diff --git a/CityInfo.WEB/Components/Loading.razor b/CityInfo.WEB/Components/Loading.razor new file mode 100644 index 0000000..1281447 --- /dev/null +++ b/CityInfo.WEB/Components/Loading.razor @@ -0,0 +1,8 @@ +
+
+
Chargement...
+
+
+
+
+
diff --git a/CityInfo.WEB/Components/PageHeader.razor b/CityInfo.WEB/Components/PageHeader.razor index ac8839c..7507e77 100644 --- a/CityInfo.WEB/Components/PageHeader.razor +++ b/CityInfo.WEB/Components/PageHeader.razor @@ -5,14 +5,28 @@
@NameType

@Name

-
-
- - - Ajouter - + @if(Link != null) + { +
+
+ @if(LinkType == LinkType.Create) + { + + + Ajouter + + } else if(LinkType == LinkType.Edit) + { + + + Editer + + } + +
-
+ } +
\ No newline at end of file diff --git a/CityInfo.WEB/Components/PageHeader.razor.cs b/CityInfo.WEB/Components/PageHeader.razor.cs index 1363e57..7a36ae3 100644 --- a/CityInfo.WEB/Components/PageHeader.razor.cs +++ b/CityInfo.WEB/Components/PageHeader.razor.cs @@ -2,6 +2,11 @@ namespace CityInfo.WEB.Components { + public enum LinkType + { + Create, + Edit + } public partial class PageHeader { [Parameter] @@ -9,6 +14,8 @@ namespace CityInfo.WEB.Components [Parameter] public string NameType { get; set; } = string.Empty; [Parameter] - public string Link { get; set; } = string.Empty; + public string? Link { get; set; } + [Parameter] + public LinkType LinkType { get; set; } = LinkType.Create; } } diff --git a/CityInfo.WEB/Layout/NavMenu.razor b/CityInfo.WEB/Layout/NavMenu.razor index ce2e637..33d345b 100644 --- a/CityInfo.WEB/Layout/NavMenu.razor +++ b/CityInfo.WEB/Layout/NavMenu.razor @@ -21,7 +21,7 @@ Accueil - +