예제 #1
0
        internal async Task <string> AddBeers(string query)
        {
            TasterDal dal      = new TasterDal();
            UnTapped  unTapped = new UnTapped();

            UnTappedBeerSearch.Root result = await unTapped.SearchUnTapped(query);

            foreach (var res in result.response.beers.items)
            {
                UnTappedBeerInfo.Root info = unTapped.GetBeerInfo(res.beer.bid).Result;
                dal.AddUnTappedBeer(info);
            }
            return("Vei");
        }
예제 #2
0
        internal async Task <List <BeerVM> > SearchUnTapped(string query, bool forceUntapped)
        {
            List <BeerVM>   beersToReturn = new List <BeerVM>();
            List <Beverage> beers         = new List <Beverage>();

            if (!forceUntapped)
            {
                beers = dal.SearchForBeers(query);
                beers.ForEach(a => beersToReturn.Add(new BeerVM(a)));
            }

            if (!beers.Any() || forceUntapped)
            {
                UnTapped unTapped = new UnTapped();
                UnTappedBeerSearch.Root result = await unTapped.SearchUnTapped(query);

                beersToReturn = result.response.beers.items.Select(a => new BeerVM(a)).ToList();
            }
            return(beersToReturn);
        }
        public async Task <UnTappedBeerSearch.Root> Search(string query)
        {
            UnTapped untappedAsync = new UnTapped();

            return(await untappedAsync.SearchUnTapped(query));
        }