Add Update route controller to fetch charts and adapt model to allow for response parsing

This commit is contained in:
2022-02-09 20:19:32 +00:00
parent 21aff4096f
commit b6e5f09c11
2 changed files with 46 additions and 15 deletions

View File

@ -16,6 +16,26 @@ namespace EFB.Models
public Chart[] Approach { get; set; }
public Chart[] Transition { get; set; }
public Chart[] PilotBriefing { get; set; }
public ChartModel(ChartList response)
{
General = FillChart(response.General);
TextualData = FillChart(response.TextualData);
GroundLayout = FillChart(response.GroundLayout);
SID = FillChart(response.SID);
STAR = FillChart(response.STAR);
Approach = FillChart(response.Approach);
Transition = FillChart(response.Transition);
PilotBriefing = FillChart(response.PilotBriefing);
}
private Chart[] FillChart(ChartsCollection collection){
if (collection != null)
{
return collection.Charts;
}
return new Chart[]{};
}
}
public class Pinned
@ -33,4 +53,5 @@ namespace EFB.Models
// public string PseudoURL { get; set; }
// public string URL { get; set; }
// }
}