public ActionResult LabourServiceMapList(int?page, int?rows) { var pageNo = page ?? 1; var numOfRows = rows ?? 5; var labourServiceMaps = labourServiceMapRepository.GetAll().OrderBy(l => l.Labour.Name).ToList().ToPagedList(pageNo, numOfRows); return(View(labourServiceMaps)); }
/*City-List Search*/ /*LabourServiceMap-List Search*/ public JsonResult SearchLabourServiceMapList(string searchBy, string searchValue, int?page, int?rows) { var pageNo = page ?? 1; var numOfRows = rows ?? 5; List <LabourServiceMap> labourServiceMapList; switch (searchBy) { case "id": //search by id labourServiceMapList = labourServiceMapRepository.GetAll().Where(l => l.Id.ToString().Contains(searchValue) || searchValue == null).ToList(); break; case "labourId": //search by city labourServiceMapList = labourServiceMapRepository.GetAll().Where(l => l.Labour.Id.ToString().ToLower().Contains(searchValue.ToLower()) || searchValue == null).ToList(); break; case "serviceId": //search by city labourServiceMapList = labourServiceMapRepository.GetAll().Where(l => l.Service.Id.ToString().ToLower().Contains(searchValue.ToLower()) || searchValue == null).ToList(); break; case "labourName": //search by city labourServiceMapList = labourServiceMapRepository.GetAll().Where(l => l.Labour.Name.ToString().ToLower().Contains(searchValue.ToLower()) || searchValue == null).ToList(); break; case "serviceName": //search by city labourServiceMapList = labourServiceMapRepository.GetAll().Where(l => l.Service.ServiceName.ToString().ToLower().Contains(searchValue.ToLower()) || searchValue == null).ToList(); break; default: //by default, search by name labourServiceMapList = labourServiceMapRepository.GetAll().Where(l => l.Id.ToString().ToLower().Contains(searchValue.ToLower()) || searchValue == null).ToList(); break; } return(Json(labourServiceMapList, JsonRequestBehavior.AllowGet)); }