// GET: /<controller>/ public async Task <ActionResult> Index(PagedResultRequestDto input) { IReadOnlyList <DepartmentCourseReadDto> departmentCourseList = (await _departmentCourseAppService.GetAll(new PagedResultRequestDto { })).Items; IReadOnlyList <DepartmentReadDto> departmentList = (await _departmentAppService.GetAll(new PagedResultRequestDto { })).Items; IReadOnlyList <CourseReadDto> courseList = (await _courseAppService.GetAll(new PagedResultRequestDto { })).Items; var model = new Index(departmentCourseList, departmentList, courseList) { }; return(View(model)); }
// GET: /<controller>/ public async Task <ActionResult> Index(PagedResultRequestDto input) { IReadOnlyList <DepartmentInstructorReadDto> departmentInstructorList = (await _departmentInstructorAppService.GetAll(new PagedResultRequestDto { })).Items; IReadOnlyList <DepartmentReadDto> departmentList = (await _departmentAppService.GetAll(new PagedResultRequestDto { })).Items; IReadOnlyList <InstructorReadDto> instructorList = (await _instructorAppService.GetAll(new PagedResultRequestDto { })).Items; var model = new Index(departmentInstructorList, departmentList, instructorList) { }; return(View(model)); }
public IActionResult Index(int pageIndex = 1, int pageSize = 5) { var department = _departmentAppService.GetAll(); var items = department.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); var totalPage = PagingHelper.GetTotalPage(department.Count, ref pageIndex, ref pageSize); var dto = new PagedResultDto <DepartmentDto>(items, pageIndex, pageSize, department.Count, totalPage); return(View(dto)); }
public async Task <IActionResult> GetDepartmentTreeData() { var departments = await _departmentAppService.GetAll(); List <TreeModel> treeModels = new List <TreeModel>(); foreach (var item in departments) { treeModels.Add(new TreeModel() { Id = item.Id.ToString(), Parent = item.ParentId == Guid.Empty ? "#" : item.ParentId.ToString(), Text = item.Name }); } return(Json(treeModels)); }
public async Task <JsonResult> GetAsync([FromQuery] DepartmentQueryDto condition, int?pageIndex, int?pageSize) { if (pageIndex == null || pageSize == null) { if (condition.DepartmentCode != null || condition.Address != null || condition.ContactPhone != null || condition.DepartmentCode != null || condition.DepartmentName != null || condition.Email != null || condition.Fax != null || condition.Notes != null || condition.PrincipalName != null) { var list = _service.Search(condition); return(new JsonResult(new { code = 20000, list })); } var items = await _service.GetAll(); return(new JsonResult(new { code = 20000, items })); } else { var items = await _service.GetPaginationAsync(pageIndex.Value, pageSize.Value); return(new JsonResult(new { code = 20000, items })); } }