Files
systemrevivalserver/Services/Admin/Pages/Index.cshtml.cs
T
2025-12-24 20:34:48 -05:00

39 lines
1.1 KiB
C#

using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
using Server.Data;
namespace VoidScavengers.Admin.Pages;
public class IndexModel : AdminPageModel
{
private readonly GameDbContext _db;
public IndexModel(GameDbContext db)
{
_db = db;
}
public int ItemCount { get; set; }
public int MobCount { get; set; }
public int RecipeCount { get; set; }
public int PlayerCount { get; set; }
public int AssetCount { get; set; }
public string CdnBaseUrl { get; set; } = "https://assets.aeternalisgames.com";
public async Task OnGetAsync()
{
ItemCount = await _db.DungeonItemDefinitions.CountAsync();
MobCount = await _db.DungeonMobDefinitions.CountAsync();
RecipeCount = await _db.DungeonCraftingRecipes.CountAsync();
PlayerCount = await _db.Accounts.CountAsync();
AssetCount = await _db.ClientAssets.CountAsync();
// Get CDN URL from environment if set
var cdnUrl = Environment.GetEnvironmentVariable("CDN_BASE_URL");
if (!string.IsNullOrEmpty(cdnUrl))
{
CdnBaseUrl = cdnUrl;
}
}
}