public void TestCardSearch() { List <mtgCard.Card> listOfResults = new List <mtgCard.Card>(); mtgService.CardService apiService = new mtgService.CardService(); var result = apiService.Where(x => x.Name, "Lightning Bolt") //.Where(x => x.Set, "c17") .All(); /* foreach (var card in result.Value) * { * var printings = card.Printings; * foreach (var set in printings) * { * Console.WriteLine(set); * } * * }*/ if (result.Value.Count != 0) { foreach (var printing in result.Value[0].Printings) { Console.WriteLine(printing); } } //Console.ReadLine(); }
public void FindCardWithApi(Card card) { List <mtgCard.Card> listOfResults = new List <mtgCard.Card>(); mtgService.CardService apiService = new mtgService.CardService(); var searchResults = apiService.Where(x => x.Name, card.Name) .All(); if (searchResults.Value.Count != 0) { var sets = searchResults.Value[0].Printings; } }
/// <summary> /// Generates a booster pack for a specific set asynchronously. /// </summary> /// <param name="code">The set code to generate a booster for.</param> /// <returns>A <see cref="Exceptional{List{Card}}"/> representing the result containing a <see cref="List{Card}"/> or an exception.</returns> public async Task <Exceptional <List <Card> > > GenerateBoosterAsync(string code) { try { var url = new Uri(Path.Combine(BuildUri(code).AbsoluteUri, "booster")); var rootCardList = await CallWebServiceGet <RootCardListDto>(url).ConfigureAwait(false); return(Exceptional <List <Card> > .Success(CardService.MapCardsList(rootCardList), MtgApiController.CreatePagingInfo())); } catch (Exception ex) { return(Exceptional <List <Card> > .Failure(ex)); } }
/// <summary> /// Generates a booster pack for a specific set. /// </summary> /// <param name="code">The set code to generate a booster for.</param> /// <returns>A <see cref="Exceptional{List{Card}}"/> representing the result containing a <see cref="List{Card}"/> or an exception.</returns> public Exceptional <List <Card> > GenerateBooster(string code) { try { var url = new Uri(Path.Combine(BuildUri(code).AbsoluteUri, "booster"), UriKind.Absolute); var rootCardList = CallWebServiceGet <RootCardListDto>(url).Result; return(Exceptional <List <Card> > .Success(CardService.MapCardsList(rootCardList), MtgApiController.CreatePagingInfo())); } catch (AggregateException ex) { return(Exceptional <List <Card> > .Failure(ex.Flatten().InnerException)); } }