first commit

This commit is contained in:
2026-01-10 23:14:51 -06:00
commit 389715b4b4
503 changed files with 98244 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
using Microsoft.AspNetCore.Mvc;
using Rs_system.Services;
using System.Security.Claims;
namespace Rs_system.Components;
public class MenuViewComponent : ViewComponent
{
private readonly IMenuService _menuService;
public MenuViewComponent(IMenuService menuService)
{
_menuService = menuService;
}
public async Task<IViewComponentResult> InvokeAsync()
{
var userIdClaim = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier);
if (userIdClaim == null || !long.TryParse(userIdClaim.Value, out var userId))
{
return View(new Rs_system.Models.ViewModels.MenuViewModel());
}
var isRoot = HttpContext.User.IsInRole("ROOT");
var menuViewModel = await _menuService.GetUserMenuAsync(userId, isRoot);
return View(menuViewModel);
}
}