예제 #1
0
        // GET: Beers
        public ActionResult Index(string pageNumber, string name, string year)
        {
            var oLstFilters = new List <string>();

            if (pageNumber != null)
            {
                oLstFilters.Add($"p={pageNumber}");
            }
            if (name != null)
            {
                oLstFilters.Add($"name={name}");
            }
            if (year != null)
            {
                oLstFilters.Add($"year={year}");
            }

            var beers = oLstFilters.Count == 0
                ? JsonRequest.GetBeers()
                : JsonRequest.GetBeers(oLstFilters);

            return(View(beers));
        }