PlotDirector/PlotLine/ViewModels/NamesViewModels.cs

15 lines
603 B
C#

using PlotLine.Models;
namespace PlotLine.ViewModels;
public sealed class NamesLibraryViewModel
{
public Project Project { get; init; } = new();
public NameSearchFilter Filter { get; init; } = new();
public IReadOnlyList<NameLocale> Locales { get; init; } = [];
public IReadOnlyList<Book> Books { get; init; } = [];
public IReadOnlyList<NameSearchResult> Results { get; init; } = [];
public int TotalRows => Results.FirstOrDefault()?.TotalRows ?? 0;
public int TotalPages => Filter.PageSize <= 0 ? 1 : Math.Max(1, (int)Math.Ceiling(TotalRows / (double)Filter.PageSize));
}