public ActionResult SearchGood(GoodModels SwapMod)
        {
            if (SwapMod.txt == null)
            {
                SwapMod.txt = "";
            }

            category bestCategory = service.mostRatedCategory();

            System.Diagnostics.Debug.WriteLine("--  MRC =" + bestCategory.name);
            ViewBag.bestCat = bestCategory.name;


            if (SwapMod.txt.Equals(""))
            {
                SwapMod.listGoods = service.GetAll();
                SwapMod.txtSearch = "";

                return(View("SearchGood", SwapMod));
            }
            SwapMod.listGoods
                = service.GetMany(c => c.label.Contains(SwapMod.txt));

            SwapMod.txtSearch = "";
            return(View("SearchGood", SwapMod));
        }
Esempio n. 2
0
 public IActionResult Get()
 {
     try
     {
         return(Ok(service.GetAll()));
     }
     catch (Exception)
     {
         return(NotFound());
     }
 }
Esempio n. 3
0
 public GoodModels()
 {
     listGoods = IGS.GetAll();
     goood     = new goods();
 }
Esempio n. 4
0
        public JsonResult Goods()
        {
            var data = service.GetAll();

            return(Json(data, JsonRequestBehavior.AllowGet));
        }