Esempio n. 1
0
        public ActionResult Search(string Services)
        {
            actyouthservicesdb_Entities DE = new actyouthservicesdb_Entities();
            var result = DE.Services.Where(x => x.Name.StartsWith(Services)).ToList();

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public ActionResult About(string sortOrder, string searchString)
        {
            /*code for search and sort/filters*/
            ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "Name_desc" : "";
            var services = from s in db.Services
                           select s;

            if (!string.IsNullOrEmpty(searchString))
            {
                services = services.Where(s => s.Name.ToUpper().Contains(searchString.ToUpper()) || s.Description.ToUpper().Contains(searchString.ToUpper()));
            }
            switch (sortOrder)
            {
            case "Name_desc":
                services = services.OrderByDescending(s => s.Name);
                break;

            case "Date":
                services = services.OrderBy(s => s.Description);
                break;

            default:
                services = services.OrderBy(s => s.Name);
                break;
            }
            /*get map*/
            actyouthservicesdb_Entities DE = new actyouthservicesdb_Entities();

            return(View(services.ToList()));
        }