Example #1
0
        public async Task <IEnumerable <BeerDto> > GetUserBeersAsync(string username)
        {
            var beersDto = await _beerElasticsearch.GetUserBeersAsync(username);

            if (beersDto != null)
            {
                return(beersDto);
            }
            var beers = await _beerRepository.GetAllUserBeerAsync(username);

            return(AutoMapper.Mapper.Map <IEnumerable <Beer>, IEnumerable <BeerDto> >(beers));
        }
        public async Task <IEnumerable <BeerDto> > GetUserBeersAsync(string username)
        {
            var beersDto = await _beerElasticsearch.GetUserBeersAsync(username);

            if (beersDto != null)
            {
                return(beersDto);
            }
            var beers = await _beerRepository.GetAllUserBeerAsync(username,
                                                                  //"Recipe.MashSteps",
                                                                  "Recipe.MashSteps.Hops",
                                                                  "Recipe.MashSteps.Fermentables",
                                                                  "Recipe.MashSteps.Others",
                                                                  // "Recipe.BoilSteps",
                                                                  "Recipe.BoilSteps.Hops",
                                                                  "Recipe.BoilSteps.Fermentables",
                                                                  "Recipe.BoilSteps.Others",
                                                                  // "Recipe.FermentationSteps",
                                                                  "Recipe.FermentationSteps.Hops",
                                                                  "Recipe.FermentationSteps.Fermentables",
                                                                  "Recipe.FermentationSteps.Others",
                                                                  "Recipe.FermentationSteps.Yeasts",
                                                                  // "Forks"
                                                                  "Forks.ABV",
                                                                  "Forks.BeerStyle",
                                                                  "Forks.IBU",
                                                                  "Forks.SRM",
                                                                  "ABV", "IBU", "SRM", "Brewers.User", "Breweries");

            return(Mapper.Map <IEnumerable <Beer>, IEnumerable <BeerDto> >(beers));
        }