public void GetByFilterTest() { BussinessTypeModel model = new BussinessTypeModel(); var result = obj.GetByFilter(model); Assert.IsInstanceOfType(result, typeof(IEnumerable)); }
private void butSearch_Click(object sender, EventArgs e) { BussinessTypeModel model = new BussinessTypeModel(); model.BussinessName = txtFilter.Text.ToString(); var list = _repo.GetByFilter(model); dgvList.Rows.Clear(); ListToGrid(list); }
public IEnumerable<BussinessTypeModel> GetByFilter(BussinessTypeModel model) { IEnumerable<BussinessTypeModel> query = GetAll(); if (model.BussinessCode != null) { query = query.Where(p => p.BussinessCode.Contains(model.BussinessCode.ToString())); } if (model.BussinessName != null) { query = query.Where(p => p.BussinessName.Contains(model.BussinessName.ToString())); } return query; }