// GET: Search
 public ActionResult Result(string query)
 {
     using (ApplicationDbContext dbcontext = new ApplicationDbContext())
     {
         ViewBag.Query = query;
         WhiskeyLogic mngr = new WhiskeyLogic();
         List<Drink> mylist = mngr.Search(query, "" ,"", "", "", 5000000, 1);
         ViewBag.amountOfSearchResult = mylist.Count();
         mylist = mylist.Take(25).ToList();
         ViewBag.amountToShow = "25";
         ViewBag.MaxPrice = Price;
         return View(mylist);
     }
 }
        public ActionResult Result_Post(string query, string whiskeySort, string minvalue, string maxPricePerLitre, string minPricePerLitre, string Age, string amountOfResultsShown)
        {
            if (whiskeySort == null)
            {
                whiskeySort = "";
            }
            else
            {
                ViewBag.OPtRadio = whiskeySort;
            }
            ViewBag.MaxPrice = Price;

            ViewBag.Query = query;
            WhiskeyLogic mngr = new WhiskeyLogic();
            double searchPriceMaximum = maxPricePerLitre=="SEK" ? 100000 : Convert.ToDouble(maxPricePerLitre);
            double searchPriceMinimum = minPricePerLitre == "SEK" ? 1 : Convert.ToDouble(minPricePerLitre);
            string name2 = Age == "" ? "" : "Years";
            List<Drink> mylist = mngr.Search(query, name2, whiskeySort, "", "", searchPriceMaximum, searchPriceMinimum);

            if (Age == null || Age=="")
            {
                Age = "";
            }
            else
            {
                var splittedInterval=Age.Split(',');
                int minAge = Convert.ToInt32(splittedInterval[0]);
                int MaxAge = Convert.ToInt32(splittedInterval[1]);
                mylist = mngr.SortByAge(mylist, MaxAge, minAge);

                ViewBag.Age = Age;
            }

            int amountToShow = Convert.ToInt32(amountOfResultsShown);

            if (amountToShow==0)
            {
                amountOfResultsShown = "25";
                amountToShow = 25;
            }
            ViewBag.amountToShow = amountOfResultsShown;
            ViewBag.amountOfSearchResult=mylist.Count();
            mylist = mylist.Take(amountToShow).ToList();

            //return RedirectToAction("Result");
            return View(mylist);
        }