//add the flight plan to cache. public void AddToCache(FlightPlan FlightPlanObject) { string ID = CreateId(); FlightPlanListId.Add(ID); if (FlightPlanDictionary == null) { FlightPlanDictionary = new Dictionary <string, FlightPlan>(); FlightPlanDictionary.Add(ID, FlightPlanObject); } else { FlightPlanDictionary.Add(ID, FlightPlanObject); } }
public void deleteFlightPlan(IMemoryCache cache, string Id) { List <string> FlightPlanListId; if (cache.TryGetValue("FlightPlanListId", out FlightPlanListId)) { int i = FlightPlanListId.IndexOf(Id); FlightPlanListId.RemoveAt(i); } Dictionary <string, FlightPlan> FlightPlanDictionary; //remove this flight from dictionary. if (cache.TryGetValue("FlightPlanDictionary", out FlightPlanDictionary)) { FlightPlan FlightPlanObject; if (FlightPlanDictionary.TryGetValue(Id, out FlightPlanObject)) { FlightPlanDictionary.Remove(Id); } } }