mirror of
https://github.com/Jetsparrow/jetherald.git
synced 2026-01-20 23:56:08 +03:00
38 lines
840 B
C#
38 lines
840 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using JetHerald.Authorization;
|
|
using JetHerald.Services;
|
|
using JetHerald.Utils;
|
|
|
|
namespace JetHerald.Controllers.Ui;
|
|
|
|
[Permission("profile")]
|
|
public class ProfileController : Controller
|
|
{
|
|
Db Db { get; }
|
|
public ProfileController(Db db)
|
|
{
|
|
Db = db;
|
|
}
|
|
|
|
[HttpGet, Route("ui/profile/")]
|
|
public async Task<IActionResult> Index()
|
|
{
|
|
var login = HttpContext.User.GetUserLogin();
|
|
using var ctx = await Db.GetContext();
|
|
var user = await ctx.GetUser(login);
|
|
|
|
var vm = new ProfileViewModel
|
|
{
|
|
OrganizationName = user.Name,
|
|
JoinedOn = user.CreateTs,
|
|
};
|
|
return View(vm);
|
|
}
|
|
}
|
|
|
|
public class ProfileViewModel
|
|
{
|
|
public string OrganizationName { get; set; }
|
|
public DateTime JoinedOn { get; set; }
|
|
} |