public async Task <ActionResult> Employees(int?page, int?E_Department, int?E_Position, string E_Username) { EmployeeModel model = new EmployeeModel(); model.PageNumber = (page == null ? 1 : Convert.ToInt32(page)); int currentpage = model.PageNumber; int pagesize = Common.pagesize; int totalrowcount = 0; model.ddlDepartmant = GetDepartment(); model.ddlPosition = GetPosition(); int dept = (E_Department == null?0:Convert.ToInt32(E_Department)); int pos = (E_Position == null?0:Convert.ToInt32(E_Position)); model.E_Department = dept; model.E_Position = pos; model.E_Username = E_Username; List <EmployeeModel> lst = dal.BindData(currentpage, pagesize, out totalrowcount, dept, pos, E_Username); List <EmployeeModel> checkdelete = new List <EmployeeModel>(); foreach (var e in lst) { bool enable = dal.CheckDelete(e.E_ID); e.IsDelete = enable; checkdelete.Add(e); } model.Employees = checkdelete; if (lst.Count > 0) { List <ListItem> lstpager = Common.generatePager(totalrowcount, pagesize, currentpage); model.dlPager = lstpager; } return(View(model)); }