Example #1
0
        public ActionResult Index(string param = "")
        {
            IEnumerable <StoreItem> model;

            if (string.IsNullOrEmpty(param))
            {
                model = localService.GetAllProducts();
                if (model.Count() > 0)
                {
                    ViewBag.Message = string.Format("There's {0} object in the db", model.Count());
                }
            }
            long parseid;

            if (long.TryParse(param, out parseid))
            {
                model = localService.GetProductsByCategory(param);
            }
            else
            {
                model = localService.GetProductsByKeyword(param);
            }
            return(View(model));
        }