public async Task <IActionResult> Get(int id) { try { return(Ok( await this._schoolRepository.QueryAsync <DepartmentModel, Department, DepartmentModel, Department> ( q => q.Where(d => d.DepartmentID == id).Single(), KendoUIHelpers.GetIncludes <DepartmentModel>(a => a.Include(x => x.AdministratorName)) ) )); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> Get(int id) { try {//typically takes less than 5 milliseconds. return(Ok ( await this._schoolRepository.QueryAsync <StudentModel, Student, StudentModel, Student> ( q => q.Where(s => s.ID == id).Single(), KendoUIHelpers.GetIncludes <StudentModel>(a => a.Include(x => x.Enrollments).ThenInclude(e => e.CourseTitle)) ) )); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> Get(int id) { try { return(Ok ( await this._schoolRepository.QueryAsync <InstructorModel, Instructor, InstructorModel, Instructor> ( q => q.Where(s => s.ID == id).Single(), KendoUIHelpers.GetIncludes <InstructorModel>(a => a.Include(e => e.Courses), a => a.Include(s => s.OfficeAssignment)) ) )); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> Get(int id) { try { return(Ok( ( await this._schoolRepository.GetItemsAsync <CourseModel, Course>(d => d.CourseID == id, lst => lst.OrderBy(s => s.Title), KendoUIHelpers.GetIncludes <CourseModel>(i => i.Include(s => s.DepartmentName))) ).Single() )); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> GetStudents([DataSourceRequest] DataSourceRequest request) { try { return(Json(await request.GetDataSourceResult <EnrollmentModel, Enrollment>(this._schoolRepository, KendoUIHelpers.GetIncludes <EnrollmentModel>(i => i.Include(s => s.CourseTitle), i => i.Include(s => s.StudentName))))); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> Get([DataSourceRequest] DataSourceRequest request) { try { return(Json(await request.GetDataSourceResult <CourseModel, Course>(this._schoolRepository, KendoUIHelpers.GetIncludes <CourseModel>(i => i.Include(s => s.DepartmentName))))); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> Get() { try { return(Ok(await this._schoolRepository.GetItemsAsync <DepartmentModel, Department>(null, lst => lst.OrderBy(s => s.Name), KendoUIHelpers.GetIncludes <DepartmentModel>(i => i.Include(s => s.AdministratorName))))); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> Get([DataSourceRequest] DataSourceRequest request) { try { //return Json(await Task.Run(() => request.GetDataSourceResult<DepartmentModel, Department>(this._context.Departments, this.mapper, Help.GetIncludes<DepartmentModel>(i => i.Include(s => s.AdministratorName))))); return(Json(await request.GetDataSourceResult <DepartmentModel, Department>(this._schoolRepository, KendoUIHelpers.GetIncludes <DepartmentModel>(i => i.Include(s => s.AdministratorName))))); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> Get([DataSourceRequest] DataSourceRequest request) { try { return(Json(await request.GetDataSourceResult <InstructorModel, Instructor>(this._schoolRepository, KendoUIHelpers.GetIncludes <InstructorModel>(i => i.Include(s => s.Courses).ThenInclude(c => c.CourseTitle), i => i.Include(s => s.OfficeAssignment))))); } catch (Exception ex) { return(BadRequest(ex.Message)); } }