Esempio n. 1
0
        public async Task <ResponseObject> UpdateAsync(Tournament selectedTournament)
        {
            TournamentDAO tournamentDAO = new TournamentDAO(selectedTournament);
            HttpContent   putContent    = new StringContent(JObject.FromObject(tournamentDAO).ToString());

            putContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");

            var wc       = new AuthHttpClient();
            var response = await wc.PutAsync(new Uri(ApiAccess.TournamentUrl + "/" + selectedTournament.Id), putContent);

            return(GetResponseService.TraiteResponse(response, new TournamentDAO(), false));
        }
Esempio n. 2
0
        public async Task <bool> UpdateAsync(Tournament selectedTournament)
        {
            TournamentDAO tournamentDAO = new TournamentDAO(selectedTournament);
            HttpContent   putContent    = new StringContent(JObject.FromObject(tournamentDAO).ToString());

            putContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");

            var wc = new AuthHttpClient();

            try
            {
                var response = await wc.PutAsync(await ApiAccess.GetRessource(ApiAccess.URL.TOURNAMENTS, selectedTournament.Id), putContent);

                GetResponseService.HandleResponse(response, new TournamentDAO(), false);
                return(true);
            }
            catch (HttpRequestException)
            {
                throw new GetDataException();
            }
        }