Esempio n. 1
0
        public void AddPoints()
        {
            if (_pointsRepository.GetAll().Any())
            {
                return;
            }
            _logger.LogWarning("Adding points");

            var points  = new List <PointOfInterest> {
            };
            string json = File.ReadAllText("../Isen.DotNet.Library/json/pointsofinterests.json");

            points = JsonConvert.DeserializeObject <List <PointOfInterest> >(json);

            foreach (var item in points)
            {
                item.Categorie       = _categorieRepository.Single(item.NameCategorie);
                item.Adresse.Commune = _communeRepository.Single(item.Adresse.NameCommune);
            }

            _pointsRepository.UpdateRange(points);
            _pointsRepository.Save();

            _logger.LogWarning("Added points");
        }