public JsonResult GetCourses() { DataTableGenerator dtGen = new DataTableGenerator(); DataTable coursesDT = new DataTable(); coursesDT = dtGen.GetDataTable(@"SELECT id,coursename,par,blueteeRating,WhiteTeeRating,CourseSlope,AddressID From Courses"); string coursesDTstring = dtGen.ConvertDataTableToJSONString(coursesDT); return Json(coursesDTstring, JsonRequestBehavior.AllowGet); }
public JsonResult GetUsers() { DataTableGenerator dtGen = new DataTableGenerator(); DataTable usersDT = new DataTable(); usersDT = dtGen.GetDataTable("Select id,fname,lname,email,username from Users"); string usersJSONString = dtGen.ConvertDataTableToJSONString(usersDT); return Json(usersJSONString, JsonRequestBehavior.AllowGet); }
public JsonResult GetScores() { DataTableGenerator dtGen = new DataTableGenerator(); DataTable scoresDT = new DataTable(); scoresDT = dtGen.GetDataTable(@" select top 20 scores.id,users.id,scores.courseid,courses.coursename,scores.score,scores.dateplayed,scores.adjustedscore from scores inner join users on scores.userid = users.id inner join courses on courses.id = scores.courseid where users.id = " + Convert.ToInt32(Session["id"]) + "order by scores.dateplayed DESC"); string scoresJSONString = dtGen.ConvertDataTableToJSONString(scoresDT); return Json(scoresJSONString, JsonRequestBehavior.AllowGet); }