public void AddPoi() { if (_poiRepository.GetAll().Any()) { return; } _logger.LogWarning("Adding poi"); var m_pointinteret = JsonConvert.DeserializeObject <dynamic>(File.ReadAllText("../Isen.DotNet.Library/Poi.json")); var poi = new List <Poi> { }; String dept; String dept2; foreach (var m_poi in m_pointinteret.Poi) { dept = m_poi.Adresse.ToString(); dept2 = m_poi.Categorie.ToString(); poi.Add(new Poi { Name = m_poi.Nom.ToString(), Description = m_poi.Description.ToString(), Address = _addressRepository.Single(dept), Category = _catpoiRepository.Single(dept2) }); } _poiRepository.UpdateRange(poi); _poiRepository.Save(); _logger.LogWarning("Added poi"); }
public ActionResult <IReadOnlyList <Poi> > Get() { return(Ok(_repository.GetAll())); }
public virtual JsonResult GetAllAction() { IEnumerable <Poi> allpois = _poiRepository.GetAll(); return(Json(allpois)); }