Глобальный рефакторинг пространств имён

This commit is contained in:
2025-10-02 13:29:30 +04:00
parent d23d81fb53
commit 2fa94851cb
3176 changed files with 27146 additions and 30584 deletions
+64
View File
@@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
using Pf2e.Database;
using Pf2e.Database.Model;
using Pf2e.Database.Model.Base;
using Pf2e.Database.Model.Enum;
using Pf2e.Database.Model.Structure;
namespace Pf2e.Web.Pages
{
public class EntityModel : PageModel
{
private readonly Pf2e.Database.Pf2eDbContext _context;
public EntityModel(Pf2e.Database.Pf2eDbContext context)
{
_context = context;
}
public IEntity Entity;
public Dictionary<string, string> Fields = [];
public Dictionary<string, List<Entity>> References = [];
public async Task<IActionResult> OnGetAsync(string type, string slug)
{
Entity entity =
_context
.Entities.Where(e =>
e.Slug == slug && e.Type == EntityTypeModel.Enum<EntityType>(type)
)
.Include(e => e.Sources)
.ThenInclude(s => s.Source)
.Include(e => e.Keywords)
.Include(e => e.Externals)
.ThenInclude(x => x.Target)
.Include(e => e.Traits)
.ThenInclude(t => t.Entity)
.FirstOrDefault() ?? throw new("Entity is null");
/*
if (id == null)
{
return NotFound();
}
var class = await _context.Classes.FirstOrDefaultAsync(m => m.Id == id);
if (class is not null)
{
Class = class;
return Page();
}
*/
return NotFound();
}
}
}