47 lines
1.6 KiB
Text
47 lines
1.6 KiB
Text
@page "/Games/{id:guid}/Saves"
|
|
@using SortDirection = AntDesign.SortDirection
|
|
@inherits OwningComponentBase
|
|
@attribute [Authorize(Roles = RoleService.AdministratorRoleName)]
|
|
@inject GameSaveService GameSaveService
|
|
@inject IMessageService MessageService
|
|
@inject ILogger<Saves> Logger
|
|
|
|
<GameEditView Id="Id" Title="Saves">
|
|
<DataTable
|
|
TItem="GameSave"
|
|
Query="gs => gs.GameId == Id"
|
|
Responsive
|
|
Context="save">
|
|
<BoundDataColumn Property="g => g.User.UserName" Include="User" />
|
|
<BoundDataColumn Property="g => g.CreatedOn" Format="MM/dd/yyyy hh:mm tt" DefaultSortOrder="SortDirection.Descending" />
|
|
<BoundDataColumn Property="g => g.Size">
|
|
<ByteSize Value="save.Size" />
|
|
</BoundDataColumn>
|
|
<DataActions TData="string">
|
|
<a href="/Download/Save/@(save.Id)" target="_blank" class="ant-btn ant-btn-text ant-btn-icon-only">
|
|
<Icon Type="@IconType.Outline.Download"/>
|
|
</a>
|
|
|
|
<Popconfirm OnConfirm="() => Delete(save)" Title="Are you sure you want to delete this game save?">
|
|
<Button Icon="@IconType.Outline.Close" Type="@ButtonType.Text" Danger/>
|
|
</Popconfirm>
|
|
</DataActions>
|
|
</DataTable>
|
|
</GameEditView>
|
|
|
|
@code {
|
|
[Parameter] public Guid Id { get; set; }
|
|
|
|
async Task Delete(GameSave gameSave)
|
|
{
|
|
try
|
|
{
|
|
await GameSaveService.DeleteAsync(gameSave);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageService.Error($"Could not delete game save!");
|
|
Logger.LogError(ex, "Could not delete the game save!");
|
|
}
|
|
}
|
|
}
|