public List <Batch> GetBatchBySearch(BatchSearchCriteria model) { IQueryable <Batch> batches = db.Batches.Where(c => c.IsDeleted == false).AsQueryable(); //if (!string.IsNullOrEmpty(model.Course.Name)) //{ // batches = batches.Where(c => c.Course.Name.ToLower().Contains(model.Course.Name.ToLower())); //} if (!string.IsNullOrEmpty(model.Description)) { batches = batches.Where( c => c.Description.ToString().ToLower().Contains(model.Description.ToString().ToLower())); } if (!string.IsNullOrEmpty(model.Name)) { batches = batches.Where( c => c.Name.ToString().ToLower().Contains(model.Name.ToString().ToLower())); } if (!string.IsNullOrEmpty(model.StartDate.ToString())) { batches = batches.Where(c => c.StartDate >= model.StartDate); } //if (!string.IsNullOrEmpty(model.EndDate.ToString())) //{ // batches = batches.Where(c => c.EndDate <= model.EndDate); //} return(batches.ToList()); }
public ActionResult Index(BatchSearchCriteria model) { var batches = _batchManager.GetBatchBySearch(model); if (batches == null) { batches = new List <Batch>(); } model.OrganizationListItem = GetOrganizationList(); model.ListOfBatch = batches; return(View(model)); }
//Index and Batch Search public ActionResult Index(BatchSearchCriteria model) { var batch = _batchManager.GetBatchBySearch(model); if (batch == null) { batch = new List <Batch>(); } model.ListOfBatch = batch; return(View(model)); }
public List <Batch> GetBatchBySearch(BatchSearchCriteria model) { List <Batch> batches = _batchRepository.GetBatchBySearch(model); return(batches); }