This repository has been archived on 2023-04-02. You can view files and clone it, but cannot push or open issues or pull requests.
trainav/trainav.web/Pages/Index.cshtml.cs

18 lines
458 B
C#
Raw Normal View History

using System.Linq;
2020-06-11 20:29:16 +02:00
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.RazorPages;
2022-04-29 14:59:24 +02:00
using trainav.web.database;
using trainav.web.database.Tables;
using trainav.web.Utils;
2020-06-11 20:29:16 +02:00
2022-05-03 00:20:02 +02:00
namespace trainav.web.Pages;
2020-06-11 20:29:16 +02:00
2022-05-03 00:20:02 +02:00
public class IndexModel : PageModel {
public User AuthorizedUser;
2020-06-11 20:29:16 +02:00
2022-05-03 00:20:02 +02:00
public void OnGet() {
using var db = new Database.DbConn();
AuthorizedUser = db.Users.FirstOrDefault(p => p.Username == AuthUtil.GetRemoteUser(HttpContext, db));
2020-06-11 20:29:16 +02:00
}
}