internal async Task <Result> AddBeer(int id) { UnTapped unTapped = new UnTapped(); UnTappedBeerInfo.Root info = await unTapped.GetBeerInfo(id); dal.AddUnTappedBeer(info); return(new Result()); }
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"); }
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)); }