コード例 #1
0
        public async Task <IActionResult> CocktailSearchResults(string keyword, string page, string pageSize)
        {
            Tuple <IList <Cocktail>, bool> cocktails;
            var model = new CocktailSearchViewModel()
            {
                Keyword = keyword == null ? "" : keyword,
                Page    = int.Parse(page)
            };

            cocktails = await cocktailService.FindCocktailsForUserAsync(model.Keyword, model.Page, int.Parse(pageSize), null);

            foreach (var cocktail in cocktails.Item1)
            {
                model.Cocktails.Add(new CocktailViewModel(cocktail));
            }
            model.LastPage = cocktails.Item2;
            return(PartialView("_MagicianCocktailsView", model));
        }
コード例 #2
0
        public async Task <IActionResult> FavoriteCocktailsResultPartial(string keyword, string pageSize, string page)
        {
            var userId = int.Parse(this.User.FindFirst(System.Security.Claims.ClaimTypes.NameIdentifier).Value);
            Tuple <IList <Cocktail>, bool> cocktails;
            var model = new CocktailSearchViewModel()
            {
                Keyword = keyword == null ? "" : keyword,
                Page    = int.Parse(page)
            };

            cocktails = await cocktailService.FindCocktailsForUserAsync(model.Keyword, model.Page, int.Parse(pageSize), userId);

            foreach (var cocktail in cocktails.Item1)
            {
                model.Cocktails.Add(new CocktailViewModel(cocktail));
            }
            model.LastPage = cocktails.Item2;
            return(PartialView("_FavoriteCocktailsResultView", model));
        }