Exemplo 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");
        }
 public IEnumerable <PointOfInterest> Get()
 {
     return(_repository.GetAll());
 }
Exemplo n.º 3
0
        public JsonResult getAllAction()
        {
            IEnumerable <PointOfInterest> pointOfInterests = _pointOfInterestRepository.GetAll();

            return(Json(pointOfInterests));
        }
Exemplo n.º 4
0
 public IEnumerable <PointOfInterest> GetAllPointOfInterests()
 {
     return(_pointOfInterestRepository.GetAll());
 }