29 lines
674 B
C#
29 lines
674 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
using Pf2eModel;
|
|
using Pf2eModel.Model.Enum;
|
|
|
|
namespace Pf2eWeb.Pages;
|
|
|
|
public class IndexModel : PageModel
|
|
{
|
|
private readonly ILogger<IndexModel> _logger;
|
|
|
|
public readonly Pf2eDbContext Context;
|
|
|
|
public Dictionary<EntityType, int> Data { get; set; } = new();
|
|
|
|
public IndexModel(ILogger<IndexModel> logger, Pf2eDbContext context)
|
|
{
|
|
_logger = logger;
|
|
Context = context;
|
|
}
|
|
|
|
public void OnGet()
|
|
{
|
|
Data = Context
|
|
.Entities.GroupBy(e => e.Type)
|
|
.ToDictionary(entities => entities.Key, entities => entities.Count());
|
|
}
|
|
}
|