Основа для ASP-сайта для просмотра сущностей

This commit is contained in:
2025-10-02 13:04:30 +04:00
parent 781546b84c
commit d23d81fb53
107 changed files with 83814 additions and 97 deletions
+28
View File
@@ -0,0 +1,28 @@
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());
}
}