diff --git a/Minecraft.Crafting.Api/Controllers/CraftingController.cs b/Minecraft.Crafting.Api/Controllers/CraftingController.cs index 1d6ac43..3c41e5e 100644 --- a/Minecraft.Crafting.Api/Controllers/CraftingController.cs +++ b/Minecraft.Crafting.Api/Controllers/CraftingController.cs @@ -77,14 +77,6 @@ namespace Minecraft.Crafting.Api.Controllers return Task.FromResult(item); } - [HttpGet] - [Route("image")] - public Task GetImage(String nameImage) - { - var image = File.Exists($"{WebHostEnvironment.WebRootPath}/Data/images/{nameImage}"); - return null; - } - [HttpGet] [Route("recipe")] public Task> GetRecipe() diff --git a/Minecraft.Crafting.Api/Data/musique.json b/Minecraft.Crafting.Api/Data/musique.json index df19145..6e2b50c 100644 --- a/Minecraft.Crafting.Api/Data/musique.json +++ b/Minecraft.Crafting.Api/Data/musique.json @@ -5,7 +5,7 @@ "auteur": "breakable", "duree": 277, "genre": "birch_planks", - "image": "Senmei", + "image": "default.png", "date": "1963-07-08T00:00:00" }, { @@ -14,7 +14,7 @@ "auteur": "digger", "duree": 55, "genre": "oak_planks", - "image": "Orbaxter", + "image": "default.png", "date": "2008-07-07T00:00:00" }, { @@ -23,7 +23,7 @@ "auteur": "vanishable", "duree": 634, "genre": "jungle_planks", - "image": "Comvey", + "image": "default.png", "date": "2009-07-19T00:00:00" }, { @@ -32,7 +32,7 @@ "auteur": "armor_chest", "duree": 2123, "genre": "warped_planks", - "image": "Qimonk", + "image": "default.png", "date": "1965-09-07T00:00:00" }, { @@ -50,7 +50,7 @@ "auteur": "armor_chest", "duree": 2325, "genre": "warped_planks", - "image": "Exoplode", + "image": "default.png", "date": "1964-04-10T00:00:00" }, { @@ -59,7 +59,7 @@ "auteur": "armor_chest", "duree": 1984, "genre": "birch_planks", - "image": "Venoflex", + "image": "default.png", "date": "1971-06-12T00:00:00" }, { @@ -68,7 +68,7 @@ "auteur": "vanishable", "duree": 104, "genre": "jungle_planks", - "image": "Vicon", + "image": "default.png", "date": "2015-05-23T00:00:00" }, { @@ -77,7 +77,7 @@ "auteur": "digger", "duree": 1390, "genre": "warped_planks", - "image": "Marqet", + "image": "default.png", "date": "2010-05-21T00:00:00" }, { @@ -86,7 +86,7 @@ "auteur": "vanishable", "duree": 242, "genre": "oak_planks", - "image": "Xeronk", + "image": "default.png", "date": "1950-08-23T00:00:00" }, { @@ -95,7 +95,7 @@ "auteur": "breakable", "duree": 1601, "genre": "warped_planks", - "image": "Magnemo", + "image": "default.png", "date": "2020-11-19T00:00:00" }, { @@ -104,7 +104,7 @@ "auteur": "digger", "duree": 3443, "genre": "warped_planks", - "image": "Artiq", + "image": "default.png", "date": "2003-09-03T00:00:00" }, { @@ -113,7 +113,7 @@ "auteur": "armor_head", "duree": 2904, "genre": "dark_oak_planks", - "image": "Geekko", + "image": "default.png", "date": "1965-10-25T00:00:00" }, { @@ -122,7 +122,7 @@ "auteur": "digger", "duree": 502, "genre": "oak_planks", - "image": "Waab", + "image": "default.png", "date": "1971-08-26T00:00:00" }, { @@ -131,7 +131,7 @@ "auteur": "armor_head", "duree": 2695, "genre": "birch_planks", - "image": "Orbean", + "image": "default.png", "date": "2000-06-22T00:00:00" }, { @@ -140,7 +140,7 @@ "auteur": "vanishable", "duree": 1013, "genre": "oak_planks", - "image": "Xth", + "image": "default.png", "date": "1963-12-15T00:00:00" }, { @@ -149,7 +149,7 @@ "auteur": "armor_chest", "duree": 1886, "genre": "birch_planks", - "image": "Springbee", + "image": "default.png", "date": "1952-09-27T00:00:00" }, { @@ -158,7 +158,7 @@ "auteur": "armor_chest", "duree": 3047, "genre": "spruce_planks", - "image": "Brainclip", + "image": "default.png", "date": "1990-02-03T00:00:00" }, { @@ -167,7 +167,7 @@ "auteur": "armor_chest", "duree": 1957, "genre": "birch_planks", - "image": "Singavera", + "image": "default.png", "date": "2005-03-19T00:00:00" }, { @@ -176,7 +176,7 @@ "auteur": "weapon", "duree": 287, "genre": "warped_planks", - "image": "Biohab", + "image": "default.png", "date": "1977-03-11T00:00:00" }, { @@ -185,7 +185,7 @@ "auteur": "digger", "duree": 2819, "genre": "warped_planks", - "image": "Momentia", + "image": "default.png", "date": "2003-02-22T00:00:00" }, { @@ -194,7 +194,7 @@ "auteur": "breakable", "duree": 114, "genre": "spruce_planks", - "image": "Elemantra", + "image": "default.png", "date": "1999-02-26T00:00:00" }, { @@ -203,7 +203,7 @@ "auteur": "breakable", "duree": 1322, "genre": "spruce_planks", - "image": "Quordate", + "image": "default.png", "date": "1956-07-19T00:00:00" }, { @@ -212,7 +212,7 @@ "auteur": "weapon", "duree": 3341, "genre": "warped_planks", - "image": "Volax", + "image": "default.png", "date": "1994-11-28T00:00:00" }, { @@ -221,7 +221,7 @@ "auteur": "weapon", "duree": 2761, "genre": "acacia_planks", - "image": "Surelogic", + "image": "default.png", "date": "1981-07-20T00:00:00" }, { @@ -230,7 +230,7 @@ "auteur": "digger", "duree": 1522, "genre": "spruce_planks", - "image": "Autograte", + "image": "default.png", "date": "1998-01-29T00:00:00" }, { @@ -239,7 +239,7 @@ "auteur": "armor", "duree": 1585, "genre": "birch_planks", - "image": "Papricut", + "image": "default.png", "date": "2002-12-04T00:00:00" }, { @@ -248,7 +248,7 @@ "auteur": "armor", "duree": 241, "genre": "oak_planks", - "image": "Freakin", + "image": "default.png", "date": "1957-01-09T00:00:00" }, { @@ -257,7 +257,7 @@ "auteur": "armor", "duree": 225, "genre": "acacia_planks", - "image": "Isopop", + "image": "default.png", "date": "1959-07-06T00:00:00" }, { @@ -266,7 +266,7 @@ "auteur": "breakable", "duree": 629, "genre": "birch_planks", - "image": "Xoggle", + "image": "default.png", "date": "1965-04-15T00:00:00" }, { @@ -275,7 +275,7 @@ "auteur": "weapon", "duree": 689, "genre": "birch_planks", - "image": "Peticular", + "image": "default.png", "date": "1996-11-16T00:00:00" }, { @@ -284,7 +284,7 @@ "auteur": "armor_chest", "duree": 2062, "genre": "crimson_planks", - "image": "Colaire", + "image": "default.png", "date": "1979-04-30T00:00:00" }, { @@ -293,7 +293,7 @@ "auteur": "vanishable", "duree": 2447, "genre": "crimson_planks", - "image": "Reversus", + "image": "default.png", "date": "2018-09-20T00:00:00" }, { @@ -302,7 +302,7 @@ "auteur": "armor", "duree": 1580, "genre": "jungle_planks", - "image": "Callflex", + "image": "default.png", "date": "2021-04-27T00:00:00" }, { @@ -311,7 +311,7 @@ "auteur": "armor", "duree": 3491, "genre": "crimson_planks", - "image": "Poochies", + "image": "default.png", "date": "1987-11-24T00:00:00" }, { @@ -320,7 +320,7 @@ "auteur": "armor", "duree": 3295, "genre": "jungle_planks", - "image": "Xixan", + "image": "default.png", "date": "1989-12-24T00:00:00" }, { @@ -329,7 +329,7 @@ "auteur": "vanishable", "duree": 1531, "genre": "warped_planks", - "image": "Hivedom", + "image": "default.png", "date": "1995-06-17T00:00:00" }, { @@ -338,7 +338,7 @@ "auteur": "armor_chest", "duree": 7, "genre": "crimson_planks", - "image": "Lingoage", + "image": "default.png", "date": "1972-06-30T00:00:00" }, { @@ -347,7 +347,7 @@ "auteur": "armor_chest", "duree": 2048, "genre": "dark_oak_planks", - "image": "Pearlesex", + "image": "default.png", "date": "2006-11-22T00:00:00" } ] \ No newline at end of file diff --git a/Minecraft.Crafting.Api/Minecraft.Crafting.Api.csproj b/Minecraft.Crafting.Api/Minecraft.Crafting.Api.csproj index 83a91e5..3a715f6 100644 --- a/Minecraft.Crafting.Api/Minecraft.Crafting.Api.csproj +++ b/Minecraft.Crafting.Api/Minecraft.Crafting.Api.csproj @@ -1,4 +1,4 @@ - + net6.0 @@ -6,6 +6,17 @@ enable + + + + + + + + + + + @@ -17,9 +28,4 @@ - - - - - diff --git a/Minecraft.Crafting.Api/Program.cs b/Minecraft.Crafting.Api/Program.cs index 1ce8d54..c97aaaa 100644 --- a/Minecraft.Crafting.Api/Program.cs +++ b/Minecraft.Crafting.Api/Program.cs @@ -22,10 +22,6 @@ app.UseAuthorization(); app.MapControllers(); -app.UseStaticFiles(new StaticFileOptions -{ - RequestPath = "/data", - -}); +app.UseStaticFiles(); app.Run(); diff --git a/ProjetBlazor/wwwroot/images/default.png b/Minecraft.Crafting.Api/wwwroot/images/default.png similarity index 100% rename from ProjetBlazor/wwwroot/images/default.png rename to Minecraft.Crafting.Api/wwwroot/images/default.png diff --git a/Minecraft.Crafting.Api/wwwroot/musiques/rick.mp3 b/Minecraft.Crafting.Api/wwwroot/musiques/rick.mp3 new file mode 100644 index 0000000..456f5ba Binary files /dev/null and b/Minecraft.Crafting.Api/wwwroot/musiques/rick.mp3 differ diff --git a/ProjetBlazor/Pages/Edit.razor.cs b/ProjetBlazor/Pages/Edit.razor.cs index 0611e27..932289e 100644 --- a/ProjetBlazor/Pages/Edit.razor.cs +++ b/ProjetBlazor/Pages/Edit.razor.cs @@ -42,17 +42,22 @@ namespace ProjetBlazor.Pages protected override async Task OnInitializedAsync() { - var item = await DataService.GetById(Id); - + var musique = await DataService.GetById(Id); + /* var fileContent = await File.ReadAllBytesAsync($"{WebHostEnvironment.WebRootPath}/images/default.png"); if (File.Exists($"{WebHostEnvironment.WebRootPath}/images/{musiqueModele.titre}.png")) { fileContent = await File.ReadAllBytesAsync($"{WebHostEnvironment.WebRootPath}/images/{item.titre}.png"); + }*/ + + var file = await File.ReadAllBytesAsync("https://localhost:7234/images/default.png"); + if (!musique.image.Equals("default.png")){ + file = await File.ReadAllBytesAsync("https://localhost:7234/images/{musique.image}"); } // Set the model with the item - musiqueModele = MusiqueFactory.ToModel(item, fileContent); + musiqueModele = MusiqueFactory.ToModel(musique, file); } } } diff --git a/ProjetBlazor/Pages/MusiquesListe.razor b/ProjetBlazor/Pages/MusiquesListe.razor index b11daf1..a35fc2a 100644 --- a/ProjetBlazor/Pages/MusiquesListe.razor +++ b/ProjetBlazor/Pages/MusiquesListe.razor @@ -20,20 +20,12 @@ - @if (File.Exists($"{WebHostEnvironment.WebRootPath}/images/{context.image}.png")) - { - - } - else - { - - } + - - - - - + + + + \ No newline at end of file diff --git a/ProjetBlazor/Pages/Play.razor b/ProjetBlazor/Pages/Play.razor new file mode 100644 index 0000000..b2d0e79 --- /dev/null +++ b/ProjetBlazor/Pages/Play.razor @@ -0,0 +1,15 @@ +@page "/Play" + + +

Play

+ +
+
Rick :
+ +
diff --git a/ProjetBlazor/Pages/Play.razor.cs b/ProjetBlazor/Pages/Play.razor.cs new file mode 100644 index 0000000..5fabc3d --- /dev/null +++ b/ProjetBlazor/Pages/Play.razor.cs @@ -0,0 +1,8 @@ + + +namespace ProjetBlazor.Pages +{ + public partial class Play + { + } +} diff --git a/ProjetBlazor/ProjetBlazor.csproj b/ProjetBlazor/ProjetBlazor.csproj index 1669763..bae3c79 100644 --- a/ProjetBlazor/ProjetBlazor.csproj +++ b/ProjetBlazor/ProjetBlazor.csproj @@ -10,7 +10,10 @@ - + + + +
diff --git a/ProjetBlazor/Resources/Pages.MusiquesListe.fr-FR.resx b/ProjetBlazor/Resources/Pages.MusiquesListe.fr-FR.resx index bb82739..0b4ede2 100644 --- a/ProjetBlazor/Resources/Pages.MusiquesListe.fr-FR.resx +++ b/ProjetBlazor/Resources/Pages.MusiquesListe.fr-FR.resx @@ -117,9 +117,21 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Auteur + + + Date + + + Genre + Ma playlist + + Durée (s) + Titre diff --git a/ProjetBlazor/Resources/Pages.MusiquesListe.resx b/ProjetBlazor/Resources/Pages.MusiquesListe.resx index 8300879..a5a4ecd 100644 --- a/ProjetBlazor/Resources/Pages.MusiquesListe.resx +++ b/ProjetBlazor/Resources/Pages.MusiquesListe.resx @@ -120,9 +120,18 @@ Author + + Date + + + Genre + My playlist + + Duration (s) + Title diff --git a/ProjetBlazor/Resources/Shared.NavMenu.fr-FR.resx b/ProjetBlazor/Resources/Shared.NavMenu.fr-FR.resx new file mode 100644 index 0000000..20327a4 --- /dev/null +++ b/ProjetBlazor/Resources/Shared.NavMenu.fr-FR.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Modifier + + \ No newline at end of file diff --git a/ProjetBlazor/Resources/Shared.NavMenu.resx b/ProjetBlazor/Resources/Shared.NavMenu.resx new file mode 100644 index 0000000..3b676e5 --- /dev/null +++ b/ProjetBlazor/Resources/Shared.NavMenu.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Edition + + \ No newline at end of file diff --git a/ProjetBlazor/Services/DataApiService.cs b/ProjetBlazor/Services/DataApiService.cs index 3deb84d..6d7270e 100644 --- a/ProjetBlazor/Services/DataApiService.cs +++ b/ProjetBlazor/Services/DataApiService.cs @@ -48,5 +48,6 @@ namespace ProjetBlazor.Services await _http.PutAsJsonAsync($"https://localhost:7234/api/Crafting/{id}", musique); } + } } diff --git a/ProjetBlazor/Services/IDataService.cs b/ProjetBlazor/Services/IDataService.cs index 54022f5..8e9da8a 100644 --- a/ProjetBlazor/Services/IDataService.cs +++ b/ProjetBlazor/Services/IDataService.cs @@ -15,5 +15,6 @@ namespace ProjetBlazor.Services Task GetById(int id); Task Count(); + } } diff --git a/ProjetBlazor/Shared/NavMenu.razor b/ProjetBlazor/Shared/NavMenu.razor index 23446f3..de84e37 100644 --- a/ProjetBlazor/Shared/NavMenu.razor +++ b/ProjetBlazor/Shared/NavMenu.razor @@ -21,12 +21,12 @@ diff --git a/ProjetBlazor/Shared/NavMenu.razor.cs b/ProjetBlazor/Shared/NavMenu.razor.cs new file mode 100644 index 0000000..0b4a9ea --- /dev/null +++ b/ProjetBlazor/Shared/NavMenu.razor.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.Extensions.Localization; +using ProjetBlazor.Pages; + +namespace ProjetBlazor.Shared +{ + public partial class NavMenu + { + [Inject] + public IStringLocalizer Localizer { get; set; } + } +} diff --git a/README.md b/README.md index e057d44..e3148f1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Lien notation : - https://codefirst.iut.uca.fr/documentation/julien.riboulet/docusaurus/Blazor/ + https://codefirst.iut.uca.fr/documentation/julien.riboulet/docusaurus/Blazor/fr/ ## Thème :