64 lines
No EOL
2.3 KiB
Text
64 lines
No EOL
2.3 KiB
Text
@page "/turrets"
|
|
@rendermode InteractiveServer
|
|
@using Microsoft.EntityFrameworkCore
|
|
@using Microsoft.AspNetCore.Components.QuickGrid
|
|
@using Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter
|
|
@using ZenithInfo.Models
|
|
@using ZenithInfo.Data
|
|
@implements IAsyncDisposable
|
|
@inject IDbContextFactory<ZenithInfoContext> DbFactory
|
|
|
|
<PageTitle>Index</PageTitle>
|
|
|
|
<h1>Index</h1>
|
|
|
|
<div>
|
|
<input type="search" @bind="nameFilter" @bind:event="oninput" />
|
|
</div>
|
|
|
|
<p>
|
|
<a href="turrets/create">Create New</a>
|
|
</p>
|
|
|
|
<div>
|
|
<QuickGrid Class="table" Items="FilteredTurrets" Pagination="pagination">
|
|
<PropertyColumn Property="turret => turret.Name" Sortable="true" />
|
|
<PropertyColumn Property="turret => turret.Description" />
|
|
<PropertyColumn Property="turret => turret.Damage" />
|
|
<PropertyColumn Property="turret => turret.Reload" />
|
|
<PropertyColumn Property="turret => turret.Range" />
|
|
<PropertyColumn Property="turret => turret.OptimalRange" Title="Optimal Range" />
|
|
<PropertyColumn Property="turret => turret.AccuracyFalloffRange" Title="Accuracy Falloff Range" />
|
|
<PropertyColumn Property="turret => turret.Accuracy" />
|
|
<PropertyColumn Property="turret => turret.Size" />
|
|
<PropertyColumn Property="turret => turret.Type" />
|
|
<PropertyColumn Property="turret => turret.Icon" />
|
|
<PropertyColumn Property="turret => turret.BeamSize" />
|
|
<PropertyColumn Property="turret => turret.BaseCost" />
|
|
<PropertyColumn Property="turret => turret.Rarity" />
|
|
|
|
<TemplateColumn Context="turret">
|
|
<a href="@($"turrets/edit?id={turret.Id}")">Edit</a> |
|
|
<a href="@($"turrets/details?id={turret.Id}")">Details</a> |
|
|
<a href="@($"turrets/delete?id={turret.Id}")">Delete</a>
|
|
</TemplateColumn>
|
|
</QuickGrid>
|
|
</div>
|
|
|
|
<Paginator State="pagination" />
|
|
|
|
@code {
|
|
private ZenithInfoContext context = default!;
|
|
private PaginationState pagination = new PaginationState { ItemsPerPage = 5 };
|
|
private string nameFilter = string.Empty;
|
|
|
|
private IQueryable<Turret> FilteredTurrets =>
|
|
context.Turret.Where(m => m.Name!.Contains(nameFilter));
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
context = DbFactory.CreateDbContext();
|
|
}
|
|
|
|
public async ValueTask DisposeAsync() => await context.DisposeAsync();
|
|
} |