Update Route Controller to ensure that response is valid before parsin

This commit is contained in:
Luke Else 2022-02-09 20:22:46 +00:00
parent b6e5f09c11
commit c3a414285a

View File

@ -170,10 +170,16 @@ namespace EFB.Controllers
{
//Get Response from Charts
ResponseModel<ChartResponse> responseDepartureCharts = await requestDepartureCharts;
user.DepartureCharts = new ChartModel(responseDepartureCharts.Result.Response);
if (responseDepartureCharts.Error == null && responseDepartureCharts.Result.Status == "success")
{
user.DepartureCharts = new ChartModel(responseDepartureCharts.Result.Response);
}
ResponseModel<ChartResponse> responseArrivalCharts = await requestArrivalCharts;
user.ArrivalCharts = new ChartModel(responseArrivalCharts.Result.Response);
if (responseArrivalCharts.Error == null && responseArrivalCharts.Result.Status == "success")
{
user.ArrivalCharts = new ChartModel(responseArrivalCharts.Result.Response);
}
//fill in route
string finalRoute = RouteModel.ParseRoute(routeString);