public void AjaxSeatList() { var db = new FakeDatabase(); var st = new FakeSkyTap(); db.AddSet(TestSeatTempData.SeatTemps); var controller = new ClassroomsController(db, st); controller.ControllerContext = new FakeControllerContext(); DTParameters param = new DTParameters() {SessionId= "12345", Start = 2, Length = 3, Search = new DTSearch(), Order = new DTOrder[1] { new DTOrder() { Column = 1, Dir = DTOrderDir.ASC } } }; JsonResult result = controller.AjaxSeat(param) as JsonResult; Assert.IsNotNull(result); Assert.AreEqual(3, ((List<SeatTemp>)((DTResult<SeatTemp>)result.Data).data).Count); }
public void DataCenterAjaxList() { var db = new FakeDatabase(); db.AddSet(TestDataCenterData.DataCenters); var controller = new DataCentersController(db); controller.ControllerContext = new FakeControllerContext(); DTParameters param = new DTParameters() { Start = 2, Length = 3, Search = new DTSearch(), Order = new DTOrder[1] { new DTOrder() { Column = 1, Dir = DTOrderDir.ASC } } }; JsonResult result = controller.Ajax(param) as JsonResult; Assert.IsNotNull(result); Assert.AreEqual(3, ((List<DataCenter>)((DTResult<DataCenter>)result.Data).data).Count); Assert.AreEqual("Test2", ((List<DataCenter>)((DTResult<DataCenter>)result.Data).data)[0].Name); }
/// <summary> /// Provides a response to an AJAX request for a list of courses. /// </summary> /// <param name="param">The filter, sort and paging configuration from the DataTable</param> /// <returns>A JSON response with the requested data</returns> public ActionResult Ajax(DTParameters param) { return this.Json(Generic.Ajax<Log>(this.db.Query<Log>().OrderByDescending(l => l.TimeStamp).ToList(), param)); }
/// <summary> /// Provides a response to an AJAX request for a list of machines associated with this course. /// </summary> /// <param name="param">The filter, sort and paging configuration from the DataTable</param> /// <returns>A JSON response with the requested data</returns> public JsonResult MachineAjax(DTParameters param) { DTResult<CourseMachineTemp> result = Generic.Ajax<CourseMachineTemp>(this.db.Query<CourseMachineTemp>().Where(cmt => cmt.SessionId == param.SessionId).ToList(), param); return this.Json(result); }
/// <summary> /// Provides a response to an AJAX request for a list of courses. /// </summary> /// <param name="param">The filter, sort and paging configuration from the DataTable</param> /// <returns>A JSON response with the requested data</returns> public ActionResult Ajax(DTParameters param) { return this.Json(Generic.Ajax<Course>(this.db.Query<Course>().ToList(), param)); }