public async Task <JsonResult> ListOfStaff(int iDisplayLength, int iDisplayStart, int iSortCol_0, string sSortDir_0, string sSearch) { int rowNumber; int totalRecord; List <Staff> Staffs = new List <Staff>(); Staffs = await Task.Run(() => _IStaffServices.GetAllData(iDisplayLength, iDisplayStart, iSortCol_0, sSortDir_0, sSearch)); totalRecord = await Task.Run(() => _IStaffServices.TotalRowCount()); rowNumber = Staffs.Count(); Staffs = Staffs.Skip(iDisplayStart).Take(iDisplayLength).ToList(); JsonResult result = new JsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = new { iTotalRecords = totalRecord, iTotalDisplayRecords = rowNumber, aaData = Staffs } }; return(result); }
public async Task <ActionResult> Action(int?id) { if (id > 0) { _entity = await Task.Run(() => _IReturnServices.GetDataById(id.Value)); _IReturn.ID = _entity.ID; _IReturn.ReturnDate = _entity.ReturnDate; _IReturn.StudentID = _entity.StudentID; _IReturn.BookID = _entity.BookID; _IReturn.StaffID = _entity.StaffID; } _IReturn.Students = await Task.Run(() => _IStudentServices.GetAllData()); _IReturn.Books = await Task.Run(() => _IBookService.GetAllData()); _IReturn.Staffs = await Task.Run(() => _IStaffServices.GetAllData()); return(View(_IReturn)); }