Beispiel #1
0
        public async Task <IHttpActionResult> PostPOI(POI pOI)
        {
            client = DBWebApiHttpClient.GetClient();
            var response = await client.PostAsJsonAsync("api/POI", pOI);

            if (response.IsSuccessStatusCode)
            {
                POIDTO poiDTO = await response.Content.ReadAsAsync <POIDTO>();

                return(Ok(poiDTO));
            }

            return(BadRequest("Error " + response.ReasonPhrase));
        }
Beispiel #2
0
        public async Task <IHttpActionResult> Get(int id)
        {
            client = DBWebApiHttpClient.GetClient();

            POIDTO poiDTO   = null;
            var    response = await client.GetAsync("api/POI/" + id);

            if (response.IsSuccessStatusCode)
            {
                poiDTO = await response.Content.ReadAsAsync <POIDTO>();

                return(Ok(poiDTO));
            }

            return(BadRequest());
        }