예제 #1
0
        private static void ImportAstronomers()
        {
            string jsonFile    = File.ReadAllText("../../../Resources/astronomers.json");
            var    astronomers = JsonConvert.DeserializeObject <IEnumerable <AstronomerDto> >(jsonFile);

            foreach (var astronom in astronomers)
            {
                if (astronom.FirstName == null || astronom.LastName == null)
                {
                    Printer.PrintError();
                    continue;
                }
                var astronomer = new Astronomer
                {
                    FirstName = astronom.FirstName,
                    LastName  = astronom.LastName
                };
                QueryMethods.AddAstronome(astronomer);
            }
        }