diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite index d6d3ffe..5cfb7f8 100644 Binary files a/.vs/slnx.sqlite and b/.vs/slnx.sqlite differ diff --git a/Code/.vs/BlazorApp/DesignTimeBuild/.dtbcache.v2 b/Code/.vs/BlazorApp/DesignTimeBuild/.dtbcache.v2 index 9b266c3..b2aea91 100644 Binary files a/Code/.vs/BlazorApp/DesignTimeBuild/.dtbcache.v2 and b/Code/.vs/BlazorApp/DesignTimeBuild/.dtbcache.v2 differ diff --git a/Code/.vs/BlazorApp/FileContentIndex/095a9e88-0040-47b8-a23e-6c7fe03a87e7.vsidx b/Code/.vs/BlazorApp/FileContentIndex/095a9e88-0040-47b8-a23e-6c7fe03a87e7.vsidx new file mode 100644 index 0000000..f87032b Binary files /dev/null and b/Code/.vs/BlazorApp/FileContentIndex/095a9e88-0040-47b8-a23e-6c7fe03a87e7.vsidx differ diff --git a/Code/.vs/BlazorApp/FileContentIndex/2807b671-dfab-45f7-b1f6-a6874d12ce9b.vsidx b/Code/.vs/BlazorApp/FileContentIndex/2807b671-dfab-45f7-b1f6-a6874d12ce9b.vsidx deleted file mode 100644 index 017f6be..0000000 Binary files a/Code/.vs/BlazorApp/FileContentIndex/2807b671-dfab-45f7-b1f6-a6874d12ce9b.vsidx and /dev/null differ diff --git a/Code/.vs/BlazorApp/FileContentIndex/c1ada97b-834d-44f8-bbd7-f09428e62ea4.vsidx b/Code/.vs/BlazorApp/FileContentIndex/302e7e32-179f-4a01-9c91-9a199b0e405a.vsidx similarity index 61% rename from Code/.vs/BlazorApp/FileContentIndex/c1ada97b-834d-44f8-bbd7-f09428e62ea4.vsidx rename to Code/.vs/BlazorApp/FileContentIndex/302e7e32-179f-4a01-9c91-9a199b0e405a.vsidx index 2ec86d2..2b20a08 100644 Binary files a/Code/.vs/BlazorApp/FileContentIndex/c1ada97b-834d-44f8-bbd7-f09428e62ea4.vsidx and b/Code/.vs/BlazorApp/FileContentIndex/302e7e32-179f-4a01-9c91-9a199b0e405a.vsidx differ diff --git a/Code/.vs/BlazorApp/FileContentIndex/3606de9f-dd67-4f30-9d00-66f72ea61e44.vsidx b/Code/.vs/BlazorApp/FileContentIndex/3606de9f-dd67-4f30-9d00-66f72ea61e44.vsidx new file mode 100644 index 0000000..82d010d Binary files /dev/null and b/Code/.vs/BlazorApp/FileContentIndex/3606de9f-dd67-4f30-9d00-66f72ea61e44.vsidx differ diff --git a/Code/.vs/BlazorApp/FileContentIndex/fbd8d010-904e-4862-825e-61f0005e9550.vsidx b/Code/.vs/BlazorApp/FileContentIndex/39a91296-80e4-4fc2-a58a-a5b7c837d3c7.vsidx similarity index 89% rename from Code/.vs/BlazorApp/FileContentIndex/fbd8d010-904e-4862-825e-61f0005e9550.vsidx rename to Code/.vs/BlazorApp/FileContentIndex/39a91296-80e4-4fc2-a58a-a5b7c837d3c7.vsidx index 9c96a8e..f79ddf0 100644 Binary files a/Code/.vs/BlazorApp/FileContentIndex/fbd8d010-904e-4862-825e-61f0005e9550.vsidx and b/Code/.vs/BlazorApp/FileContentIndex/39a91296-80e4-4fc2-a58a-a5b7c837d3c7.vsidx differ diff --git a/Code/.vs/BlazorApp/FileContentIndex/3c3f9d3c-dd1f-4130-8522-85889ae3fa4f.vsidx b/Code/.vs/BlazorApp/FileContentIndex/3c3f9d3c-dd1f-4130-8522-85889ae3fa4f.vsidx deleted file mode 100644 index 09668a2..0000000 Binary files a/Code/.vs/BlazorApp/FileContentIndex/3c3f9d3c-dd1f-4130-8522-85889ae3fa4f.vsidx and /dev/null differ diff --git a/Code/.vs/BlazorApp/FileContentIndex/93da5407-2184-4e3f-9271-1a61caef1264.vsidx b/Code/.vs/BlazorApp/FileContentIndex/3f3b083e-128a-4cc9-8f02-e830c29876c5.vsidx similarity index 56% rename from Code/.vs/BlazorApp/FileContentIndex/93da5407-2184-4e3f-9271-1a61caef1264.vsidx rename to Code/.vs/BlazorApp/FileContentIndex/3f3b083e-128a-4cc9-8f02-e830c29876c5.vsidx index 810c85e..a89d637 100644 Binary files a/Code/.vs/BlazorApp/FileContentIndex/93da5407-2184-4e3f-9271-1a61caef1264.vsidx and b/Code/.vs/BlazorApp/FileContentIndex/3f3b083e-128a-4cc9-8f02-e830c29876c5.vsidx differ diff --git a/Code/.vs/BlazorApp/FileContentIndex/438e662a-5490-48f9-aab9-a13c8373a2e9.vsidx b/Code/.vs/BlazorApp/FileContentIndex/438e662a-5490-48f9-aab9-a13c8373a2e9.vsidx new file mode 100644 index 0000000..77e421d Binary files /dev/null and b/Code/.vs/BlazorApp/FileContentIndex/438e662a-5490-48f9-aab9-a13c8373a2e9.vsidx differ diff --git a/Code/.vs/BlazorApp/FileContentIndex/70b2018b-94d5-420c-aea2-1625040b6c8a.vsidx b/Code/.vs/BlazorApp/FileContentIndex/692517b2-e26f-4000-bae2-e4f6dc965c1c.vsidx similarity index 57% rename from Code/.vs/BlazorApp/FileContentIndex/70b2018b-94d5-420c-aea2-1625040b6c8a.vsidx rename to Code/.vs/BlazorApp/FileContentIndex/692517b2-e26f-4000-bae2-e4f6dc965c1c.vsidx index 9f4600b..3746a0d 100644 Binary files a/Code/.vs/BlazorApp/FileContentIndex/70b2018b-94d5-420c-aea2-1625040b6c8a.vsidx and b/Code/.vs/BlazorApp/FileContentIndex/692517b2-e26f-4000-bae2-e4f6dc965c1c.vsidx differ diff --git a/Code/.vs/BlazorApp/FileContentIndex/777ae5fb-044a-46aa-b209-290e6a658bed.vsidx b/Code/.vs/BlazorApp/FileContentIndex/777ae5fb-044a-46aa-b209-290e6a658bed.vsidx deleted file mode 100644 index c3ee79f..0000000 Binary files a/Code/.vs/BlazorApp/FileContentIndex/777ae5fb-044a-46aa-b209-290e6a658bed.vsidx and /dev/null differ diff --git a/Code/.vs/BlazorApp/FileContentIndex/53d04266-cef5-46ad-a991-a35a41415e49.vsidx b/Code/.vs/BlazorApp/FileContentIndex/7ca26a5d-6434-4f3a-adb9-ccc159e2190e.vsidx similarity index 62% rename from Code/.vs/BlazorApp/FileContentIndex/53d04266-cef5-46ad-a991-a35a41415e49.vsidx rename to Code/.vs/BlazorApp/FileContentIndex/7ca26a5d-6434-4f3a-adb9-ccc159e2190e.vsidx index 34fe36c..d7cb7a3 100644 Binary files a/Code/.vs/BlazorApp/FileContentIndex/53d04266-cef5-46ad-a991-a35a41415e49.vsidx and b/Code/.vs/BlazorApp/FileContentIndex/7ca26a5d-6434-4f3a-adb9-ccc159e2190e.vsidx differ diff --git a/Code/.vs/BlazorApp/FileContentIndex/cc91acab-2103-4388-a709-364046456c8b.vsidx b/Code/.vs/BlazorApp/FileContentIndex/9866ac50-9c05-4944-b197-29a6632a1387.vsidx similarity index 65% rename from Code/.vs/BlazorApp/FileContentIndex/cc91acab-2103-4388-a709-364046456c8b.vsidx rename to Code/.vs/BlazorApp/FileContentIndex/9866ac50-9c05-4944-b197-29a6632a1387.vsidx index e805cdd..4ff412a 100644 Binary files a/Code/.vs/BlazorApp/FileContentIndex/cc91acab-2103-4388-a709-364046456c8b.vsidx and b/Code/.vs/BlazorApp/FileContentIndex/9866ac50-9c05-4944-b197-29a6632a1387.vsidx differ diff --git a/Code/.vs/BlazorApp/FileContentIndex/d4f2eba4-7d24-4295-897d-9ddb5ed213d4.vsidx b/Code/.vs/BlazorApp/FileContentIndex/996953ff-6166-4005-a2df-58496da2b091.vsidx similarity index 63% rename from Code/.vs/BlazorApp/FileContentIndex/d4f2eba4-7d24-4295-897d-9ddb5ed213d4.vsidx rename to Code/.vs/BlazorApp/FileContentIndex/996953ff-6166-4005-a2df-58496da2b091.vsidx index 74c70d9..fd0be4d 100644 Binary files a/Code/.vs/BlazorApp/FileContentIndex/d4f2eba4-7d24-4295-897d-9ddb5ed213d4.vsidx and b/Code/.vs/BlazorApp/FileContentIndex/996953ff-6166-4005-a2df-58496da2b091.vsidx differ diff --git a/Code/.vs/BlazorApp/FileContentIndex/59d46e25-b863-4b69-9091-0fd677470ad4.vsidx b/Code/.vs/BlazorApp/FileContentIndex/a0954d1a-df95-4067-aa32-dc28b895112c.vsidx similarity index 67% rename from Code/.vs/BlazorApp/FileContentIndex/59d46e25-b863-4b69-9091-0fd677470ad4.vsidx rename to Code/.vs/BlazorApp/FileContentIndex/a0954d1a-df95-4067-aa32-dc28b895112c.vsidx index b8503ca..84d8950 100644 Binary files a/Code/.vs/BlazorApp/FileContentIndex/59d46e25-b863-4b69-9091-0fd677470ad4.vsidx and b/Code/.vs/BlazorApp/FileContentIndex/a0954d1a-df95-4067-aa32-dc28b895112c.vsidx differ diff --git a/Code/.vs/BlazorApp/FileContentIndex/4f4f4bad-0671-4712-ac83-80479f057ec7.vsidx b/Code/.vs/BlazorApp/FileContentIndex/a5de7489-9763-43f7-81fa-0b4c285f3204.vsidx similarity index 64% rename from Code/.vs/BlazorApp/FileContentIndex/4f4f4bad-0671-4712-ac83-80479f057ec7.vsidx rename to Code/.vs/BlazorApp/FileContentIndex/a5de7489-9763-43f7-81fa-0b4c285f3204.vsidx index 074a26a..d46ef15 100644 Binary files a/Code/.vs/BlazorApp/FileContentIndex/4f4f4bad-0671-4712-ac83-80479f057ec7.vsidx and b/Code/.vs/BlazorApp/FileContentIndex/a5de7489-9763-43f7-81fa-0b4c285f3204.vsidx differ diff --git a/Code/.vs/BlazorApp/FileContentIndex/5dacf32c-4205-4848-af7c-6b40de5a5819.vsidx b/Code/.vs/BlazorApp/FileContentIndex/c470a985-ba00-4120-baea-751cc6d43d7c.vsidx similarity index 60% rename from Code/.vs/BlazorApp/FileContentIndex/5dacf32c-4205-4848-af7c-6b40de5a5819.vsidx rename to Code/.vs/BlazorApp/FileContentIndex/c470a985-ba00-4120-baea-751cc6d43d7c.vsidx index e3b302b..d1562c7 100644 Binary files a/Code/.vs/BlazorApp/FileContentIndex/5dacf32c-4205-4848-af7c-6b40de5a5819.vsidx and b/Code/.vs/BlazorApp/FileContentIndex/c470a985-ba00-4120-baea-751cc6d43d7c.vsidx differ diff --git a/Code/.vs/BlazorApp/FileContentIndex/c557a65d-3b86-4f11-8f75-dcc254f2b17b.vsidx b/Code/.vs/BlazorApp/FileContentIndex/c557a65d-3b86-4f11-8f75-dcc254f2b17b.vsidx new file mode 100644 index 0000000..fb1d9fc Binary files /dev/null and b/Code/.vs/BlazorApp/FileContentIndex/c557a65d-3b86-4f11-8f75-dcc254f2b17b.vsidx differ diff --git a/Code/.vs/BlazorApp/FileContentIndex/8718b7a1-e08f-4315-8b9d-f430554f0757.vsidx b/Code/.vs/BlazorApp/FileContentIndex/cc77efaf-6490-4c7c-92d1-1ef47042fc21.vsidx similarity index 70% rename from Code/.vs/BlazorApp/FileContentIndex/8718b7a1-e08f-4315-8b9d-f430554f0757.vsidx rename to Code/.vs/BlazorApp/FileContentIndex/cc77efaf-6490-4c7c-92d1-1ef47042fc21.vsidx index b4ca493..854e60b 100644 Binary files a/Code/.vs/BlazorApp/FileContentIndex/8718b7a1-e08f-4315-8b9d-f430554f0757.vsidx and b/Code/.vs/BlazorApp/FileContentIndex/cc77efaf-6490-4c7c-92d1-1ef47042fc21.vsidx differ diff --git a/Code/.vs/BlazorApp/v17/.suo b/Code/.vs/BlazorApp/v17/.suo index 3d619bf..0067161 100644 Binary files a/Code/.vs/BlazorApp/v17/.suo and b/Code/.vs/BlazorApp/v17/.suo differ diff --git a/Code/ProjetBlazor/Components/ItemsList.razor.cs b/Code/ProjetBlazor/Components/ItemsList.razor.cs index 3086c78..4936c66 100644 --- a/Code/ProjetBlazor/Components/ItemsList.razor.cs +++ b/Code/ProjetBlazor/Components/ItemsList.razor.cs @@ -51,9 +51,16 @@ namespace ProjetBlazor.Components public IModalService Modal { get; set; } public object Action { get; internal set; } + public ItemsList() + { + Actions = new ObservableCollection(); + Actions.CollectionChanged += OnActionsCollectionChanged; + } + + protected override async Task OnInitializedAsync() { - items = await DataService.getAll(); + items = await DataService.GetAll(); totalItem = await DataService.Count(); await base.OnInitializedAsync(); } diff --git a/Code/ProjetBlazor/Program.cs b/Code/ProjetBlazor/Program.cs index a564207..3a89cd6 100644 --- a/Code/ProjetBlazor/Program.cs +++ b/Code/ProjetBlazor/Program.cs @@ -6,6 +6,7 @@ using ProjetBlazor.Services; using Blazored.Modal; using Microsoft.AspNetCore.Localization; using System.Globalization; +using Blazor.Services; using Microsoft.Extensions.Options; var builder = WebApplication.CreateBuilder(args); diff --git a/Code/ProjetBlazor/Services/DataApiService.cs b/Code/ProjetBlazor/Services/DataApiService.cs index 1e7ac7d..b53b2e5 100644 --- a/Code/ProjetBlazor/Services/DataApiService.cs +++ b/Code/ProjetBlazor/Services/DataApiService.cs @@ -1,9 +1,15 @@ using ProjetBlazor.Components; +using ProjetBlazor.Models; using ProjetBlazor.Factories; using ProjetBlazor.Models; +using ProjetBlazor.Services; + -namespace ProjetBlazor.Services +namespace Blazor.Services { + /// + /// Service for interacting with a data API. + /// public class DataApiService : IDataService { private readonly HttpClient _http; @@ -17,35 +23,22 @@ namespace ProjetBlazor.Services _http = http; } - /// - /// Add a new item to the API. - /// - /// Model containing data for the new item. - public async Task Add(ItemModel model) - { - // Get the item - var item = ItemFactory.Create(model); - - // Save the data - await _http.PostAsJsonAsync("https://codefirst.iut.uca.fr/containers/container-blazor-web-api-marcchevaldonne/api/Crafting/", item); - } - /// /// Get the number of items in the API. /// /// Task representing the asynchronous operation, returning the number of items. public async Task Count() { - return await _http.GetFromJsonAsync("https://codefirst.iut.uca.fr/containers/container-blazor-web-api-marcchevaldonne/api/Crafting/count"); + return await _http.GetFromJsonAsync("https://localhost:7234/api/Crafting/count"); } /// - /// Get a list of items from the API, paginated. - /// - /// The current page number. - /// The number of items per page. - /// Task representing the asynchronous operation, returning a list of items. - public async Task> List(int currentPage, int pageSize) + /// Get a list of items from the API, paginated. + /// + /// The current page number. + /// The number of items per page. + /// Task representing the asynchronous operation, returning a list of items. + public async Task> List(int currentPage, int pageSize) { return await _http.GetFromJsonAsync>($"https://codefirst.iut.uca.fr/containers/container-blazor-web-api-marcchevaldonne/api/Crafting/?currentPage={currentPage}&pageSize={pageSize}"); } @@ -54,9 +47,9 @@ namespace ProjetBlazor.Services /// Get a list of all items from the API. /// /// Task representing the asynchronous operation, returning a list of items. - public async Task> getAll() + public async Task> GetAll() { - return await _http.GetFromJsonAsync>($"https://codefirst.iut.uca.fr/containers/container-blazor-web-api-marcchevaldonne/api/Crafting/all"); + return await _http.GetFromJsonAsync>($"https://localhost:7234/api/Crafting/all"); } /// @@ -68,27 +61,5 @@ namespace ProjetBlazor.Services { return await _http.GetFromJsonAsync($"https://codefirst.iut.uca.fr/containers/container-blazor-web-api-marcchevaldonne/api/Crafting/{id}"); } - - /// - /// Update an existing item in the API. - /// - /// The ID of the item to update. - /// Model containing the updated data for the item. - public async Task Update(int id, ItemModel model) - { - // Get the item - var item = ItemFactory.Create(model); - - await _http.PutAsJsonAsync($"https://codefirst.iut.uca.fr/containers/container-blazor-web-api-marcchevaldonne/api/Crafting/{id}", item); - } - - /// - /// Delete an existing item from the API. - /// - /// The ID of the item to delete. - public async Task Delete(int id) - { - await _http.DeleteAsync($"https://codefirst.iut.uca.fr/containers/container-blazor-web-api-marcchevaldonne/api/Crafting/{id}"); - } } } diff --git a/Code/ProjetBlazor/Services/IDataService.cs b/Code/ProjetBlazor/Services/IDataService.cs index 2960732..eb1f5ea 100644 --- a/Code/ProjetBlazor/Services/IDataService.cs +++ b/Code/ProjetBlazor/Services/IDataService.cs @@ -5,18 +5,13 @@ namespace ProjetBlazor.Services { public interface IDataService { - Task Add(ItemModel model); - Task Count(); Task> List(int currentPage, int pageSize); Task GetById(int id); - Task> getAll(); - - Task Update(int id, ItemModel model); + Task> GetAll(); - Task Delete(int id); } }