namespace IOL.GreatOffice.Api.Endpoints.Internal.Account; public class GetAccountRoute : RouteBaseAsync.WithoutRequest.WithActionResult { private readonly AppDbContext _context; /// public GetAccountRoute(AppDbContext context) { _context = context; } /// /// Get the logged on user's session data. /// /// /// [HttpGet("~/_/account")] public override async Task> HandleAsync(CancellationToken cancellationToken = default) { var user = _context.Users.SingleOrDefault(c => c.Id == LoggedInUser.Id); if (user != default) { return Ok(new LoggedInUserModel { Id = LoggedInUser.Id, Username = LoggedInUser.Username }); } await HttpContext.SignOutAsync(); return Unauthorized(); } }