diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Helpers/GameHelper.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Helpers/GameHelper.cs new file mode 100644 index 0000000..d806f8e --- /dev/null +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Helpers/GameHelper.cs @@ -0,0 +1,12 @@ +using GameIdeas.Shared.Dto; + +namespace GameIdeas.BlazorApp.Helpers; + +public static class GameHelper +{ + public static void WriteTrackingDto(GameDto game) + { + game.CreationUserId = 100000; + game.CreationDate = DateTime.Now; + } +} diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameCreationForm.razor b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameCreationForm.razor index c223842..103208d 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameCreationForm.razor +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameCreationForm.razor @@ -1,31 +1,36 @@ -@using GameIdeas.BlazorApp.Shared.Components.SelectSearch +@using Blazored.FluentValidation +@using GameIdeas.BlazorApp.Shared.Components.CircleLoader +@using GameIdeas.BlazorApp.Shared.Components.SelectSearch @using GameIdeas.BlazorApp.Shared.Components.Slider @using GameIdeas.Shared.Dto +
@ResourcesKey.Title :
- +
@ResourcesKey.ReleaseDate :
- +
@ResourcesKey.StorageSizeMo :
- +
@ResourcesKey.Developers :
- +
@ResourcesKey.Publishers :
- +
@@ -37,32 +42,52 @@
@ResourcesKey.Properties :
- +
@ResourcesKey.Tags :
- +
@ResourcesKey.Platforms :
- +
+ + @foreach (var platform in GameDto.Platforms ?? []) + { +
+
@platform.Label :
+ +
+ }
@ResourcesKey.Description :
- +
-
- - +
+ + +
+ + +
- \ No newline at end of file + + +@if (IsLoading) +{ + +} \ No newline at end of file diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameCreationForm.razor.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameCreationForm.razor.cs index dc6ef66..358d442 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameCreationForm.razor.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameCreationForm.razor.cs @@ -1,3 +1,5 @@ +using GameIdeas.BlazorApp.Helpers; +using GameIdeas.BlazorApp.Pages.Games.Gateways; using GameIdeas.BlazorApp.Shared.Components.Popup; using GameIdeas.BlazorApp.Shared.Components.Select.Models; using GameIdeas.BlazorApp.Shared.Components.Slider; @@ -11,29 +13,27 @@ namespace GameIdeas.BlazorApp.Pages.Games.Components; public partial class GameCreationForm { [Inject] private IJSRuntime Js { get; set; } = default!; + [Inject] private IGameGateway GameGateway { get; set; } = default!; [CascadingParameter] private Popup? Popup { get; set; } [Parameter] public CategoriesDto? Categories { get; set; } + [Parameter] public EventCallback OnSubmit { get; set; } private GameDto GameDto = new(); private EditContext? EditContext; private readonly SelectTheme Theme = SelectTheme.Creation; private readonly SliderParams SliderParams = new() { Gap = 1, Min = 1, Max = 5 }; + private bool IsLoading = false; protected override async Task OnInitializedAsync() { EditContext = new(GameDto); - - if (Popup != null) - { - Popup.StateChanged += async (_, isOpen) => await HandlePopupStateChanged(); - } - await base.OnInitializedAsync(); } - private async Task HandlePopupStateChanged() + protected override async Task OnAfterRenderAsync(bool firstRender) { await Js.InvokeVoidAsync("resizeGameForm"); + } private void HandleOnCancel() @@ -48,6 +48,26 @@ public partial class GameCreationForm return; } + try + { + IsLoading = true; + GameHelper.WriteTrackingDto(GameDto); + var gameId = await GameGateway.CreateGame(GameDto); + + if (gameId != 0) + { + Popup?.Close(); + await OnSubmit.InvokeAsync(); + } + } + catch (Exception) + { + throw; + } + finally + { + IsLoading = false; + } } } \ No newline at end of file diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameCreationForm.razor.css b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameCreationForm.razor.css index b28e0a8..f1fb03f 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameCreationForm.razor.css +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameCreationForm.razor.css @@ -1,6 +1,7 @@ .game-form { display: flex; flex-direction: row; + justify-content: space-between; gap: 20px; } @@ -24,7 +25,7 @@ grid-column: 1; } -input { +::deep input, ::deep textarea { width: 100%; background: var(--input-secondary); border: solid 1px var(--input-selected); @@ -35,10 +36,19 @@ input { color: var(--white); } - input[type="date"]::-webkit-calendar-picker-indicator { - filter: invert(1); - cursor: pointer; - } +::deep input[type="date"]::-webkit-calendar-picker-indicator { + filter: invert(1); + cursor: pointer; +} + +::deep input[type="number"]::-webkit-inner-spin-button { + -webkit-appearance: none; +} + +::deep textarea { + resize: vertical; + min-height: 140px; +} .description-container { margin-top: 8px; @@ -63,6 +73,48 @@ input { align-content: center; } -input[type="number"]::-webkit-inner-spin-button { - -webkit-appearance: none; -} \ No newline at end of file +.bottom-container { + margin-top: 8px; + height: 28px; + display: flex; + flex-direction: row; + align-items: center; +} + +::deep .invalid-content { + display: flex; + flex-wrap: wrap; + flex-shrink: 1; + margin: 0; + padding: 0; + list-style: none; + height: auto; + text-wrap: nowrap; +} + +::deep .invalid-content li { + margin-right: 8px; +} + +.buttons { + margin-left: auto; + height: 100%; + display: flex; + flex-direction: row; + gap: 8px; +} + +.buttons button { + border: none; + outline: none; + background: var(--violet); + border-radius: var(--small-radius); + color: var(--white); + font-weight: bold; + padding: 0 10px; + cursor: pointer; +} + +.buttons button:hover { + background: var(--violet-selected); +} diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameValidation.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameValidation.cs new file mode 100644 index 0000000..12eff58 --- /dev/null +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameValidation.cs @@ -0,0 +1,18 @@ +using FluentValidation; +using GameIdeas.Resources; +using GameIdeas.Shared.Dto; + +namespace GameIdeas.BlazorApp.Pages.Games.Components; + +public class GameValidation : AbstractValidator +{ + public GameValidation() + { + RuleFor(g => g.Title) + .NotEmpty().WithMessage(ResourcesKey.InvalidTitle); + + RuleFor(g => g.Interest) + .GreaterThanOrEqualTo(1).WithMessage(ResourcesKey.InvalidInterest) + .LessThanOrEqualTo(5).WithMessage(ResourcesKey.InvalidInterest); + } +} diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Filter/GameFilter.razor.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Filter/GameFilter.razor.cs index b116719..c5f2c1e 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Filter/GameFilter.razor.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Filter/GameFilter.razor.cs @@ -36,10 +36,10 @@ public partial class GameFilter { Headers = SortTypes, GetHeaderLabel = header => header.Label, - DefaultHeader = SortTypes.FirstOrDefault(h => h.SortType == SortType.Ascending), + DefaultHeaders = SortTypes.Where(h => h.SortType == SortType.Ascending).ToList(), Items = GameProperties, GetItemLabel = item => item.Label, - DefaultItem = GameProperties.FirstOrDefault(p => p.Label == "Titre") + DefaultItems = GameProperties.Where(p => p.Label == "Titre").ToList() }; } diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GameBase.razor b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GameBase.razor index e32a814..f06eaeb 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GameBase.razor +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GameBase.razor @@ -24,6 +24,6 @@
- - + + diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GameBase.razor.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GameBase.razor.cs index f00fdd0..e356f4a 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GameBase.razor.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GameBase.razor.cs @@ -17,7 +17,7 @@ public partial class GameBase () protected override async Task OnInitializedAsync() { - Categories = await GameGateway.FetchCategories(); + await HandleFetchCategories(); await base.OnInitializedAsync(); } private void HandleAddClicked(AddType addType) @@ -37,4 +37,8 @@ public partial class GameBase () { ManualAddPopup?.Close(); } + private async Task HandleFetchCategories() + { + Categories = await GameGateway.FetchCategories(); + } } \ No newline at end of file diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Gateways/GameGateway.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Gateways/GameGateway.cs index 92af68b..34873dc 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Gateways/GameGateway.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Gateways/GameGateway.cs @@ -8,6 +8,18 @@ namespace GameIdeas.BlazorApp.Pages.Games.Gateways; public class GameGateway(IHttpClientService httpClientService) : IGameGateway { + public async Task CreateGame(GameDto game) + { + try + { + return await httpClientService.PostAsync(Endpoints.Game.Create, game); + } + catch (Exception) + { + throw new GameCreationException(ResourcesKey.ErrorCreateGame); + } + } + public async Task FetchCategories() { try diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Gateways/IGameGateway.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Gateways/IGameGateway.cs index 7d71440..0269bad 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Gateways/IGameGateway.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Gateways/IGameGateway.cs @@ -5,4 +5,5 @@ namespace GameIdeas.BlazorApp.Pages.Games.Gateways; public interface IGameGateway { Task FetchCategories(); + Task CreateGame(GameDto game); } diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Header/GameHeader.razor b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Header/GameHeader.razor index dd57a3a..2e55110 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Header/GameHeader.razor +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Header/GameHeader.razor @@ -23,8 +23,7 @@ +
+ + + + } + @if (Params.Headers != null) { - @foreach (var header in Params.Headers) + @foreach (var header in Params.Headers.Union(HeaderValues ?? [])) { } @if (Params.Items != null) { - @foreach (var item in Params.Items) + @foreach (var item in Params.Items.Union(Values ?? [])) { [Parameter] public SelectTheme Theme { get; set; } [Parameter] public SelectType Type { get; set; } = SelectType.Single; [Parameter] public bool DisableClicked { get; set; } = false; + [Parameter] public bool QuickAdd { get; set; } = false; private bool IsContentOpen = false; + private string AddLabel = string.Empty; + private EditContext? QuickAddEditContext; - public void Close() => - IsContentOpen = false; - - public void Open() => - IsContentOpen = true; - - private void HandleButtonClicked() + public void Close() { - if (!DisableClicked) - IsContentOpen = !IsContentOpen; + IsContentOpen = false; } - private void HandleContentClosed() => - IsContentOpen = false; + public void Open() + { + IsContentOpen = true; + } protected override void OnInitialized() { - if (Params.DefaultItem != null) + QuickAddEditContext = new EditContext(AddLabel); + + if (Params.DefaultItems.Count != 0) { - Values.Add(Params.DefaultItem); + Values.AddRange(Params.DefaultItems); } - if (Params.DefaultHeader != null) + if (Params.DefaultHeaders.Count != 0) { - HeaderValues.Add(Params.DefaultHeader); + HeaderValues.AddRange(Params.DefaultHeaders); } } + private void HandleButtonClicked() + { + if (!DisableClicked && IsContentOpen) + Close(); + + if (!DisableClicked && !IsContentOpen) + Open(); + } + + private void HandleContentClosed() => Close(); + private async Task HandleValueClicked(TItem value) { if (Type != SelectType.Multiple || Values == null) @@ -82,4 +97,16 @@ public partial class Select await HeaderValuesChanged.InvokeAsync(HeaderValues); } + private async Task HandleSubmitAdd() + { + if (Params.AddItem != null) + { + Values ??= []; + Values.Add(Params.AddItem(AddLabel)); + + AddLabel = string.Empty; + + await ValuesChanged.InvokeAsync(Values); + } + } } \ No newline at end of file diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/Select.razor.css b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/Select.razor.css index 7dce1f0..90c1264 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/Select.razor.css +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/Select.razor.css @@ -3,7 +3,8 @@ } .button { - z-index: var(--index-component) + z-index: var(--index-component); + cursor: pointer; } .dropdown { @@ -29,6 +30,20 @@ display: none; } +.add-item { + align-content: center; + height: 24px; + padding: 0 10px; +} + +.add-item input { + width: 100%; + color: var(--white); + border: none; + outline: none; + background: transparent; +} + .dropdown::-webkit-scrollbar { width: 10px; } @@ -72,4 +87,16 @@ border-bottom: 2px solid var(--input-selected); } +/***** Sort Theme *****/ +.creation .content { + border-radius: var(--small-radius); + box-sizing: border-box; + border: solid 1px var(--violet); +} + +.creation .content .line { + display: block; + margin: 2px 6px; + border-bottom: 2px solid var(--input-selected); +} diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SelectSearch/SelectSearch.razor b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SelectSearch/SelectSearch.razor index e169a80..35c1a8a 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SelectSearch/SelectSearch.razor +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SelectSearch/SelectSearch.razor @@ -5,12 +5,12 @@ @typeparam TItem -
diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SelectSearch/SelectSearch.razor.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SelectSearch/SelectSearch.razor.cs index a9d03d7..bc2ac8e 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SelectSearch/SelectSearch.razor.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SelectSearch/SelectSearch.razor.cs @@ -13,16 +13,20 @@ public partial class SelectSearch [Parameter] public List Values { get; set; } = []; [Parameter] public EventCallback> ValuesChanged { get; set; } [Parameter] public string Placeholder { get; set; } = string.Empty; + [Parameter] public bool QuickAdd { get; set; } = false; + [Parameter] public Func? AddItem { get; set; } private SelectParams SelectParams = new(); private SearchInput? SearchInput; private Select? Select; + protected override void OnParametersSet() { SelectParams = new() { Items = Items, - GetItemLabel = GetLabel + GetItemLabel = GetLabel, + AddItem = AddItem }; base.OnParametersSet(); @@ -31,12 +35,13 @@ public partial class SelectSearch { Values = values.ToList(); SearchInput?.SetText(string.Join(", ", Values.Select(GetLabel))); - await ValuesChanged.InvokeAsync(values.ToList()); + await ValuesChanged.InvokeAsync(Values.ToList()); } - private void HandleClearClicked() + private async Task HandleClearClicked() { Values = []; + await ValuesChanged.InvokeAsync(Values.ToList()); } private void HandleFocusIn() diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Slider/Slider.razor.css b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Slider/Slider.razor.css index 5954b37..09c613a 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Slider/Slider.razor.css +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Slider/Slider.razor.css @@ -1,7 +1,7 @@ .container { position: relative; width: 100%; - z-index: var(--index-component) + z-index: 0 } input[type="range"] { diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SliderRange/SliderRange.razor.css b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SliderRange/SliderRange.razor.css index c27647d..29f1a67 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SliderRange/SliderRange.razor.css +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SliderRange/SliderRange.razor.css @@ -1,7 +1,7 @@ .container { position: relative; width: 100%; - z-index: var(--index-component) + z-index: 0 } input[type="range"] { diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Constants/Endpoints.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Constants/Endpoints.cs index f07b369..e4cad7a 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Constants/Endpoints.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Constants/Endpoints.cs @@ -4,7 +4,7 @@ public static class Endpoints { public static class Game { - + public static readonly string Create = "api/Game/Create"; } public static class Category diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Exceptions/GameCreationException.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Exceptions/GameCreationException.cs new file mode 100644 index 0000000..256ee9b --- /dev/null +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Exceptions/GameCreationException.cs @@ -0,0 +1,3 @@ +namespace GameIdeas.BlazorApp.Shared.Exceptions; + +public class GameCreationException(string message) : Exception(message); diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/wwwroot/css/app.css b/src/GameIdeas/Client/GameIdeas.BlazorApp/wwwroot/css/app.css index 7580dab..238e46c 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/wwwroot/css/app.css +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/wwwroot/css/app.css @@ -27,6 +27,7 @@ --index-backdrop: 700; --index-dropdown: 900; --index-popup: 1000; + --index-overlay: 1100; } html { @@ -41,10 +42,6 @@ html, body, #app { height: 100%; } -.valid.modified:not([type=checkbox]) { - border: 2px solid var(--green); -} - .invalid { border: 2px solid var(--red) !important; } @@ -65,7 +62,7 @@ html, body, #app { padding: 0.6rem 1.25rem 0.7rem 1.25rem; position: fixed; width: 100%; - z-index: 1000; + z-index: 10000; } #blazor-error-ui .dismiss { diff --git a/src/GameIdeas/GameIdeas.Resources/CreateStaticResourceKey.cs b/src/GameIdeas/GameIdeas.Resources/CreateStaticResourceKey.cs index 8f90fac..f39a66e 100644 --- a/src/GameIdeas/GameIdeas.Resources/CreateStaticResourceKey.cs +++ b/src/GameIdeas/GameIdeas.Resources/CreateStaticResourceKey.cs @@ -34,6 +34,10 @@ public class Translations (TranslationService translationService) public string ErrorWhenFetchingData => translationService.Translate(nameof(ErrorWhenFetchingData)); public string RequestFailedStatusFormat => translationService.Translate(nameof(RequestFailedStatusFormat)); public string ErrorFetchCategories => translationService.Translate(nameof(ErrorFetchCategories)); + public string PlaceholderAdd => translationService.Translate(nameof(PlaceholderAdd)); + public string ErrorCreateGame => translationService.Translate(nameof(ErrorCreateGame)); + public string InvalidTitle => translationService.Translate(nameof(InvalidTitle)); + public string InvalidInterest => translationService.Translate(nameof(InvalidInterest)); } public static class ResourcesKey @@ -76,4 +80,8 @@ public static class ResourcesKey public static string ErrorWhenFetchingData => _instance?.ErrorWhenFetchingData ?? throw new InvalidOperationException("ResourcesKey.ErrorWhenFetchingData is not initialized."); public static string RequestFailedStatusFormat => _instance?.RequestFailedStatusFormat ?? throw new InvalidOperationException("ResourcesKey.RequestFailedStatusFormat is not initialized."); public static string ErrorFetchCategories => _instance?.ErrorFetchCategories ?? throw new InvalidOperationException("ResourcesKey.ErrorFetchCategories is not initialized."); + public static string PlaceholderAdd => _instance?.PlaceholderAdd ?? throw new InvalidOperationException("ResourcesKey.PlaceholderAdd is not initialized."); + public static string ErrorCreateGame => _instance?.ErrorCreateGame ?? throw new InvalidOperationException("ResourcesKey.ErrorCreateGame is not initialized."); + public static string InvalidTitle => _instance?.InvalidTitle ?? throw new InvalidOperationException("ResourcesKey.InvalidTitle is not initialized."); + public static string InvalidInterest => _instance?.InvalidInterest ?? throw new InvalidOperationException("ResourcesKey.InvalidInterest is not initialized."); } \ No newline at end of file diff --git a/src/GameIdeas/GameIdeas.Shared/Constants/GlobalConstants.cs b/src/GameIdeas/GameIdeas.Shared/Constants/GlobalConstants.cs index 21d357b..373c8b2 100644 --- a/src/GameIdeas/GameIdeas.Shared/Constants/GlobalConstants.cs +++ b/src/GameIdeas/GameIdeas.Shared/Constants/GlobalConstants.cs @@ -2,6 +2,6 @@ public class GlobalConstants { - public const string EnterKeyCode = "Enter"; - public const string PadEnterKeyCode = "NumpadEnter"; + } + \ No newline at end of file diff --git a/src/GameIdeas/Server/GameIdeas.WebAPI/Controllers/GameController.cs b/src/GameIdeas/Server/GameIdeas.WebAPI/Controllers/GameController.cs index 7edf1c8..3fdcb3b 100644 --- a/src/GameIdeas/Server/GameIdeas.WebAPI/Controllers/GameController.cs +++ b/src/GameIdeas/Server/GameIdeas.WebAPI/Controllers/GameController.cs @@ -40,11 +40,12 @@ public class GameController(IGameService gameService, ILoggerFactory loggerFacto } [HttpPost("Create")] - public async Task> CreateGame([FromBody] GameDto game) + public async Task> CreateGame([FromBody] GameDto game) { try { - return Created("/Create", await gameService.CreateGame(game)); + var gameResult = await gameService.CreateGame(game); + return Created("/Create", gameResult.Id); } catch (Exception e) { @@ -54,11 +55,12 @@ public class GameController(IGameService gameService, ILoggerFactory loggerFacto } [HttpPut("Update")] - public async Task> UpdateGame([FromBody] GameDto game) + public async Task> UpdateGame([FromBody] GameDto game) { try { - return Created($"/Update", await gameService.UpdateGame(game)); + var gameResult = await gameService.UpdateGame(game); + return Created($"/Update", gameResult.Id); } catch (Exception e) { diff --git a/src/GameIdeas/Server/GameIdeas.WebAPI/Files/GameIdeas.fr.json b/src/GameIdeas/Server/GameIdeas.WebAPI/Files/GameIdeas.fr.json index a3ec135..0dcf122 100644 --- a/src/GameIdeas/Server/GameIdeas.WebAPI/Files/GameIdeas.fr.json +++ b/src/GameIdeas/Server/GameIdeas.WebAPI/Files/GameIdeas.fr.json @@ -29,5 +29,9 @@ "ErrorWhenDeletingData": "Erreur lors de la requête DELETE", "ErrorWhenFetchingData": "Erreur lors de la requête GET", "RequestFailedStatusFormat": "Erreur lors de la réponse, code {0}", - "ErrorFetchCategories": "Erreur lors de la récupération des catégories" + "ErrorFetchCategories": "Erreur lors de la récupération des catégories", + "PlaceholderAdd": "Ajouter un nouveau", + "ErrorCreateGame": "Erreur lors de la Création d'un jeu", + "InvalidTitle": "Le titre est incorrect", + "InvalidInterest": "L'interêt est incorrect'" } \ No newline at end of file