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);
 }
예제 #2
0
        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);
 }
예제 #4
0
        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);
 }
예제 #6
0
        public ActionResult Index()
        {
            howtoDBEntities db = new howtoDBEntities();

            return(View(db.Students));
        }