Exemple #1
0
        public async Task <DeleteCardResponse> DeleteCardByDeckId(int deckId, int cardId)
        {
            var response = new DeleteCardResponse();

            try
            {
                var result = await _baseUrl.AppendPathSegment($"/decks/{deckId}/cards/{cardId}")
                             .WithOAuthBearerToken(_token)
                             .DeleteAsync();

                response.IsSuccess = result.IsSuccessStatusCode;
            }
            catch (FlurlHttpException e)
            {
                response.Errors = await e.GetResponseJsonAsync <List <string> >();
            }

            return(response);
        }
        public static async Task <DeleteCardResponse> DeleteCards(string url)
        {
            DeleteCardResponse objData = new DeleteCardResponse();

            try
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(url);
                    var result = await client.GetAsync(url);

                    var place = result.Content.ReadAsStringAsync().Result;
                    objData = JsonConvert.DeserializeObject <DeleteCardResponse>(await result.Content.ReadAsStringAsync());
                }
            }
            catch (Exception ex)
            {
            }
            return(objData);
        }
 public TestableDeleteCardProcessor(DeleteCardResponse deleteCardResponse)
 {
     _deleteCardResponse = deleteCardResponse;
 }