public static void ImportPlanets() { var json = File.ReadAllText("../../../datasets/planets.json"); var planets = JsonConvert.DeserializeObject <IEnumerable <PlanetDto> >(json); PlanetStore.AddPlanets(planets); }
public static void ExportPlanets() { var planets = PlanetStore.GetPlanetsWithNoVictims(); var json = JsonConvert.SerializeObject(planets, Formatting.Indented); File.WriteAllText("../../../export/planets.json", json); }
public static void ImportPlanets() { string planetsJson = File.ReadAllText(planetsDataPath); var planets = JsonConvert.DeserializeObject <IEnumerable <PlanetDto> >(planetsJson); PlanetStore.AddPlanets(planets); }
public static void ExportPlanets(string telescope) { string planetsJson = JsonConvert.SerializeObject(PlanetStore.GetPlanetsByTelescope(telescope), Formatting.Indented); Console.WriteLine(planetsJson); File.WriteAllText($"../../exported-data/planets-by-{telescope}.json", planetsJson); }
public static void ImportPlanets() { string json = ReadJsonFile("planets"); var planets = JsonConvert.DeserializeObject <IEnumerable <PlanetDto> >(json); PlanetStore.AddPlanets(planets); }
public AgeController( PlanetStore planetStore, AgeService ageService, IClock clock) { this._planetStore = planetStore; this._ageService = ageService; this._clock = clock; }
public static void ExportPlanetsNotOriginatingAnomalies() { List <string> planets = PlanetStore.GetPlanetsWithoutOriginAnomalies(); string json = JsonConvert.SerializeObject( planets.Select(p => new { Name = p }), Formatting.Indented); File.WriteAllText("../../Export/planets.json", json); }
public static void ExportPlanets() { Console.Write("Enter telescope (e.g. TRAPPIST): "); string telescopeName = Console.ReadLine(); IEnumerable <PlanetExportDto> planets = PlanetStore.GetPlanets(telescopeName); string json = JsonConvert.SerializeObject(planets .Select(p => new { Name = p.Name, Mass = p.Mass, Orbitting = new[] { p.Orbitting } }), Formatting.Indented); File.WriteAllText($"../../Export/planets-by-{telescopeName}.json", json); }
public static void ExportPlanets(string observatoryName) { var planets = PlanetStore.GetPlanetsByObservatory(observatoryName); File.WriteAllText($"../../../export/planets-by-{observatoryName}.json", JsonConvert.SerializeObject(planets, Formatting.Indented)); }
public PlanetController(PlanetStore planetStore) { this._planetStore = planetStore; }
public static void ExportPlanets() { var telescopeName = Console.ReadLine(); PlanetStore.ExportPlanets(telescopeName); }
public static void Main() { PlanetStore.GetPlanetsByTelescope("Trappist-1"); }