2022-02-18 17:18:00 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Diagnostics;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2022-02-18 18:49:56 +00:00
|
|
|
using EFB.Sessions;
|
2022-02-18 17:18:00 +00:00
|
|
|
using Microsoft.Extensions.Logging;
|
2022-02-18 18:49:56 +00:00
|
|
|
using EFB.Models;
|
|
|
|
using EFB.MongoData;
|
2022-02-18 17:18:00 +00:00
|
|
|
|
|
|
|
namespace EFB.Controllers
|
|
|
|
{
|
|
|
|
//[Route("[controller]")]
|
|
|
|
public class FlightsimController : Controller
|
|
|
|
{
|
|
|
|
private readonly ILogger<FlightsimController> _logger;
|
|
|
|
|
|
|
|
public FlightsimController(ILogger<FlightsimController> logger)
|
|
|
|
{
|
|
|
|
_logger = logger;
|
|
|
|
}
|
|
|
|
|
2022-02-18 18:49:56 +00:00
|
|
|
public async Task<IActionResult> Index()
|
2022-02-18 17:18:00 +00:00
|
|
|
{
|
2022-02-18 18:49:56 +00:00
|
|
|
//Retrieve and Check current user status
|
|
|
|
UserModel user = HttpContext.Session.GetObject<UserModel>("User");
|
|
|
|
if(user == null) return RedirectToAction("Index", "Home");
|
|
|
|
|
|
|
|
//Retrieve the user's latest sim position and construct it into FlightsimModel
|
|
|
|
SimPositionModel latestPosition = await Mongo.GetLatestData(user.EMail);
|
|
|
|
// RouteModel route = RouteModel.StringToRoute();
|
|
|
|
|
|
|
|
|
2022-02-18 17:18:00 +00:00
|
|
|
return View();
|
|
|
|
}
|
|
|
|
|
|
|
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
|
|
|
public IActionResult Error()
|
|
|
|
{
|
|
|
|
return View("Error!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|