public IPagedList <tblAccessController> GetAllPagingByFirst(string key, string computerids, string line, string groupControllerId, int pageNumber, int pageSize) { var query = from n in _tblAccessControllerRepository.Table select n; if (!string.IsNullOrWhiteSpace(key)) { query = query.Where(n => n.ControllerName.Contains(key)); } if (!string.IsNullOrWhiteSpace(computerids)) { var lines = _tblAccessLineService.GetAllActiveByListPC(computerids); if (lines.Any()) { var str = ""; foreach (var item in lines) { str += item.LineID; } query = query.Where(n => str.Contains(n.LineID)); } else { var str = "NULL"; query = query.Where(n => str.Contains(n.LineID)); } } if (!string.IsNullOrEmpty(line) && !line.Equals("0")) { query = query.Where(n => n.LineID == line); } if (!string.IsNullOrWhiteSpace(groupControllerId)) { query = query.Where(n => n.ControllerGroupId == groupControllerId); } var list = new PagedList <tblAccessController>(query.OrderBy(n => n.LineID), pageNumber, pageSize); return(list); }
public List <SelectListModel> LineToDDL(string pcid) //bind ServicePackageId to dropdownlist { var list = new List <SelectListModel> { new SelectListModel { ItemValue = "0", ItemText = "-- Danh mục line --" }, }; var listLine = _tblAccessLineService.GetAllActiveByListPC(pcid); if (listLine.Any()) { foreach (var item in listLine) { list.Add(new SelectListModel { ItemValue = item.LineID.ToString(), ItemText = item.LineName }); } } return(list); }