public JsonResult GetStudents(string term) { howtoDBEntities db = new howtoDBEntities(); List<string> students = db.Students.Where(s => s.Name.StartsWith(term)) .Select(x => x.Name).ToList(); return Json(students, JsonRequestBehavior.AllowGet); }
public JsonResult GetStudents(string term) { howtoDBEntities db = new howtoDBEntities(); List <string> students = db.Students.Where(s => s.Name.StartsWith(term)) .Select(x => x.Name).ToList(); return(Json(students, JsonRequestBehavior.AllowGet)); }
public ActionResult Index(string searchTerm) { howtoDBEntities db = new howtoDBEntities(); List<Student> students; if (string.IsNullOrEmpty(searchTerm)) { students = db.Students.ToList(); } else { students = db.Students .Where(s => s.Name.StartsWith(searchTerm)).ToList(); } return View(students); }
public ActionResult Index(string searchTerm) { howtoDBEntities db = new howtoDBEntities(); List <Student> students; if (string.IsNullOrEmpty(searchTerm)) { students = db.Students.ToList(); } else { students = db.Students .Where(s => s.Name.StartsWith(searchTerm)).ToList(); } return(View(students)); }
public ActionResult Index() { howtoDBEntities db = new howtoDBEntities(); return View(db.Students); }
public ActionResult Index() { howtoDBEntities db = new howtoDBEntities(); return(View(db.Students)); }