public async Task <List <POI> > getPOIList(int?id) { client = PVWebApiHttpClient.GetClient(); IEnumerable <POIDTO> pois = null; var response = await client.GetAsync("api/POI/"); if (response.IsSuccessStatusCode) { pois = await response.Content.ReadAsAsync <IEnumerable <POIDTO> >(); } List <POI> poiList = new List <POI>(); foreach (POIDTO poiDTO in pois) { POI poi = DTOConverters.ConvertDTOToModel(poiDTO); if (id != null && poi.POIID != id) { poiList.Add(poi); } if (id == null) { poiList.Add(poi); } } return(poiList); }
public async Task <Percurso> getPercursoByID(int?id) { client = PVWebApiHttpClient.GetClient(); PercursoDTO percursoDTO = null; var response = await client.GetAsync("api/Percurso/" + id); if (response.IsSuccessStatusCode) { percursoDTO = await response.Content.ReadAsAsync <PercursoDTO>(); } Percurso percurso = DTOConverters.ConvertDTOToModel(percursoDTO); return(percurso); }
public static async Task <POI> getPOIByID(int?id) { client = PVWebApiHttpClient.GetClient(); POIDTO poiDTO = null; var response = await client.GetAsync("api/POI/" + id); if (response.IsSuccessStatusCode) { poiDTO = await response.Content.ReadAsAsync <POIDTO>(); } POI pOI = DTOConverters.ConvertDTOToModel(poiDTO); return(pOI); }
// GET: Percurso public async Task <ActionResult> Index() { client = PVWebApiHttpClient.GetClient(); IEnumerable <PercursoDTO> percursos = null; var response = await client.GetAsync("api/Percurso/"); if (response.IsSuccessStatusCode) { percursos = await response.Content.ReadAsAsync <IEnumerable <PercursoDTO> >(); } List <Percurso> percursosList = new List <Percurso>(); foreach (PercursoDTO percursoDTO in percursos) { Percurso percurso = DTOConverters.ConvertDTOToModel(percursoDTO); percursosList.Add(percurso); } return(View(percursosList)); }
// GET: POI public async Task <ActionResult> Index() { client = PVWebApiHttpClient.GetClient(); IEnumerable <POIDTO> pois = null; var response = await client.GetAsync("api/POI/"); if (response.IsSuccessStatusCode) { pois = await response.Content.ReadAsAsync <IEnumerable <POIDTO> >(); } List <POI> poiList = new List <POI>(); foreach (POIDTO poiDTO in pois) { POI poi = DTOConverters.ConvertDTOToModel(poiDTO); poiList.Add(poi); } return(View(poiList)); }