Files
deepdrft/DeepDrftWeb.Client/Pages/TrackGallery.razor.cs
T
daniel f0d60190cc Track Gallery front end
- For now uses a table but will replace with graphical media cards
2025-09-01 16:50:08 -04:00

29 lines
795 B
C#

using DeepDrftModels.Entities;
using DeepDrftModels.Models;
using DeepDrftWeb.Client.ViewModels;
using Microsoft.AspNetCore.Components;
namespace DeepDrftWeb.Client.Pages;
public partial class TrackGallery : ComponentBase
{
[Inject]
public required TrackGalleryViewModel ViewModel { get; set; }
protected override async Task OnInitializedAsync()
{
await SetPage(1);
}
private async Task SetPage(int newPage)
{
var result = await ViewModel.TrackClient.GetPage(newPage, ViewModel.PageSize, ViewModel.SortBy, ViewModel.IsDescending);
if (result is { Success: true, Value: PagedResult<TrackEntity> pageResult })
{
ViewModel.Page = pageResult;
ViewModel.PageSize = pageResult.PageSize;
}
}
}