Ejemplo n.º 1
0
        //public ActionResult Search(string keyword)
        //{
        //    var client = repo.FindName(keyword);
        //    ViewBag.客戶分類 = GetCategorySelect();
        //    return View("Index", client);
        //}

        //public ActionResult Filter(客戶資料 客戶資料)
        //{
        //    var client = repo.GetCategory(客戶資料.客戶分類);
        //    ViewBag.客戶分類 = GetCategorySelect();
        //    return View("Index", client);
        //}

        public IEnumerable <SelectListItem> GetCategorySelect()
        {
            List <SelectListItem> items = new List <SelectListItem>();

            foreach (var category in repo.FindCategory())
            {
                items.Add(new SelectListItem()
                {
                    Text  = category,
                    Value = category
                });
            }
            //IEnumerable<SelectListItem> items = repo.FindCategory()
            //.Select(x => new SelectListItem
            //{
            //    Value = x.客戶分類,
            //    Text = x.客戶分類
            //});
            return(items);
        }