Updated UserModel and started on making the polling http calls to the server.

Started with the Polling command:

What I'm thinking is that I should have the command consecutively make calls every 5 seconds, not sure how it will work without hanging the thread, will figure out tomorrow :)
This commit is contained in:
Luke Else 2021-12-27 21:15:55 +00:00
parent 0f96994773
commit e134751745
2 changed files with 22 additions and 1 deletions

View File

@ -100,5 +100,26 @@ namespace EFB.Controllers
} }
return RedirectToAction("Index", "Home"); return RedirectToAction("Index", "Home");
} }
public async Task<IActionResult> Poll(){
if (HttpContext.Session.GetString("User") != null)
{//If the user is currently logged in
UserModel User = HttpContext.Session.GetObject<UserModel>("User");
if (User.Route != null)
{//If the user has a route object (e.g, they have been to the route page)
//Make calls to the server to fetch route
return RedirectToAction("Index", "Route");
}else{
return RedirectToAction("Index", "Route");
}
}else{
return RedirectToAction("Index", "Route");
}
}
} }
} }

View File

@ -21,7 +21,7 @@ namespace EFB.Models
public TokenModel Token { get; set; } = null; public TokenModel Token { get; set; } = null;
//Contains the most recent route generated by the user through the App //Contains the most recent route generated by the user through the App
public object Route { get; set; } = null; public RouteModel Route { get; set; } = null;
//Contains the most recently stored position of the user in the simulator //Contains the most recently stored position of the user in the simulator
public object SimPosition { get; set; } = null; public object SimPosition { get; set; } = null;