Files
constructdemo/ConstructorAppUI/ViewComponents/AdminLayoutComponents/_AdminLayoutNavbarPartialComponent.cs
2025-05-01 15:18:30 +03:00

34 lines
1.2 KiB
C#

using ConstructorApp.DataAccessLayer.Concrete;
using ConstructorApp.EntityLayer.Entities;
using ConstructorAppUI.ViewModels;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
namespace ConstructorAppUI.ViewComponents.AdminLayoutComponents
{
public class _AdminLayoutNavbarPartialComponent : ViewComponent
{
private readonly string _signalRHubBaseUrl;
private readonly ConstructorContext _context;
private readonly UserManager<AppUser> _userManager;
public _AdminLayoutNavbarPartialComponent(IConfiguration configuration, ConstructorContext context, UserManager<AppUser> userManager)
{
_signalRHubBaseUrl = configuration["SignalRHubSettings:BaseUrl"];
_context = context;
_userManager = userManager;
}
public async Task<IViewComponentResult> InvokeAsync()
{
ViewBag.SignalRHubBaseUrl = _signalRHubBaseUrl;
var user = await _userManager.GetUserAsync(HttpContext.User);
var model = new UserProfileViewModel
{
UserName = user.UserName
};
return View(model);
}
}
}