Exemple #1
0
        // GET: Shops
        //[Authorize(Roles = "admin")]
        //[Authorize(Roles = "manager")]
        public ActionResult Index(string sortOrder, string searchString)
        {
            int lang   = LanguageBL.CheckLanguageSession();
            var shopsT = db.SPP_ShopTransDistinct(lang).ToList();

            ViewBag.NameSortParam = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            if (!String.IsNullOrEmpty((searchString)))
            {
                shopsT = shopsT.Where(s => s.nameShop.ToLower().StartsWith(searchString.ToLower())).ToList();
            }
            switch (sortOrder)
            {
            case "name_desc":
                shopsT = shopsT.OrderByDescending(d => d.nameShop).ToList();
                break;

            default:
                shopsT = shopsT.OrderBy(d => d.nameShop).ToList();
                break;
            }

            return(View(shopsT));
        }