Fix wrong comportment
All checks were successful
Game Ideas build for PR / build_test (pull_request) Successful in 1m9s
All checks were successful
Game Ideas build for PR / build_test (pull_request) Successful in 1m9s
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using GameIdeas.BlazorApp.Shared.Components.Select.Models;
|
using GameIdeas.BlazorApp.Shared.Components.Select;
|
||||||
|
using GameIdeas.BlazorApp.Shared.Components.Select.Models;
|
||||||
using GameIdeas.Resources;
|
using GameIdeas.Resources;
|
||||||
using GameIdeas.Shared.Dto;
|
using GameIdeas.Shared.Dto;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
@@ -13,6 +14,7 @@ public class GameBase : ComponentBase
|
|||||||
[Inject] public NavigationManager NavigationManager { get; set; } = default!;
|
[Inject] public NavigationManager NavigationManager { get; set; } = default!;
|
||||||
|
|
||||||
protected SelectParams<DetailOptions, object> SelectParams = default!;
|
protected SelectParams<DetailOptions, object> SelectParams = default!;
|
||||||
|
protected Select<DetailOptions, object>? SelectOption;
|
||||||
|
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
@@ -40,6 +42,8 @@ public class GameBase : ComponentBase
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SelectOption?.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetDetailOptionsLabel(DetailOptions options)
|
private string GetDetailOptionsLabel(DetailOptions options)
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
<Interest Value="GameDto.Interest" />
|
<Interest Value="GameDto.Interest" />
|
||||||
|
|
||||||
<Select TItem="DetailOptions" THeader="object" Type="SelectType.Single" Theme="SelectTheme.RowOption"
|
<Select @ref="SelectOption" TItem="DetailOptions" THeader="object" Type="SelectType.Single" Theme="SelectTheme.RowOption"
|
||||||
Params="SelectParams" ValuesChanged="HandlerSelectValuesChanged">
|
Params="SelectParams" ValuesChanged="HandlerSelectValuesChanged">
|
||||||
@Icons.Triangle
|
@Icons.Triangle
|
||||||
</Select>
|
</Select>
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Popup @ref=ManualAddPopup BackdropFilterClicked="HandleBackdropManualAddClicked" Closable=false>
|
<Popup @ref=ManualAddPopup BackdropFilterClicked="HandleBackdropManualAddClicked" Closable=false>
|
||||||
<GameCreationForm @ref="CreationForm" Categories="Categories" OnSubmit="() => HandleFetchDatas()" OnRender="HandleRenderCreationForm" />
|
<GameCreationForm @ref="CreationForm" Categories="Categories" OnSubmit="HandleOnSubmitGame" OnRender="HandleRenderCreationForm" />
|
||||||
</Popup>
|
</Popup>
|
||||||
|
|
||||||
<Popup @ref=DeletePopup Closable=false>
|
<Popup @ref=DeletePopup Closable=false>
|
||||||
|
|||||||
@@ -111,4 +111,9 @@ public partial class Games : GameBaseComponent
|
|||||||
|
|
||||||
GameIdToUpdate = null;
|
GameIdToUpdate = null;
|
||||||
}
|
}
|
||||||
|
private async Task HandleOnSubmitGame()
|
||||||
|
{
|
||||||
|
await HandleFetchDatas(false);
|
||||||
|
await HandleFetchCategories();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -19,7 +19,7 @@ public class GameBaseComponent : ComponentBase
|
|||||||
await base.OnInitializedAsync();
|
await base.OnInitializedAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task HandleFetchCategories()
|
protected async Task HandleFetchCategories()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -89,6 +89,8 @@ public class GameWriteService(GameIdeasContext context, IMapper mapper) : IGameW
|
|||||||
context.Platforms.AttachRange(gps.Select(gp => gp.Platform));
|
context.Platforms.AttachRange(gps.Select(gp => gp.Platform));
|
||||||
await context.GamePlatforms.AddRangeAsync(gps);
|
await context.GamePlatforms.AddRangeAsync(gps);
|
||||||
|
|
||||||
|
await context.SaveChangesAsync();
|
||||||
|
|
||||||
context.Platforms.RemoveRange(
|
context.Platforms.RemoveRange(
|
||||||
context.Platforms.Include(p => p.GamePlatforms)
|
context.Platforms.Include(p => p.GamePlatforms)
|
||||||
.Where(p => p.GamePlatforms.Count == 0));
|
.Where(p => p.GamePlatforms.Count == 0));
|
||||||
@@ -114,6 +116,8 @@ public class GameWriteService(GameIdeasContext context, IMapper mapper) : IGameW
|
|||||||
context.Properties.AttachRange(gps.Select(gp => gp.Property));
|
context.Properties.AttachRange(gps.Select(gp => gp.Property));
|
||||||
await context.GameProperties.AddRangeAsync(gps);
|
await context.GameProperties.AddRangeAsync(gps);
|
||||||
|
|
||||||
|
await context.SaveChangesAsync();
|
||||||
|
|
||||||
context.Properties.RemoveRange(
|
context.Properties.RemoveRange(
|
||||||
context.Properties.Include(p => p.GameProperties)
|
context.Properties.Include(p => p.GameProperties)
|
||||||
.Where(p => p.GameProperties.Count == 0));
|
.Where(p => p.GameProperties.Count == 0));
|
||||||
@@ -139,6 +143,7 @@ public class GameWriteService(GameIdeasContext context, IMapper mapper) : IGameW
|
|||||||
context.Tags.AttachRange(gts.Select(gt => gt.Tag));
|
context.Tags.AttachRange(gts.Select(gt => gt.Tag));
|
||||||
await context.GameTags.AddRangeAsync(gts);
|
await context.GameTags.AddRangeAsync(gts);
|
||||||
|
|
||||||
|
await context.SaveChangesAsync();
|
||||||
|
|
||||||
context.Tags.RemoveRange(
|
context.Tags.RemoveRange(
|
||||||
context.Tags.Include(t => t.GameTags)
|
context.Tags.Include(t => t.GameTags)
|
||||||
|
|||||||
Reference in New Issue
Block a user