public IEnumerable <BuyerModel> BuyerByFilter(string company, string userId, BuyerModel model) { IEnumerable <BuyerModel> query = GetAllBuyer(company, userId); if (model.BuyerCode != null) { query = query.Where(p => p.BuyerCode.Contains(model.BuyerCode.ToString())); } if (model.BuyerName != null) { query = query.Where(p => p.BuyerName.Contains(model.BuyerName.ToString())); } return(query); }
private void butSearch_Click(object sender, EventArgs e) { BuyerModel model = new BuyerModel(); if (cboFilter.SelectedIndex == 0) { model.BuyerCode = txtFilter.Text; } else if (cboFilter.SelectedIndex == 1) { model.BuyerName = txtFilter.Text; } var result = _repo.BuyerByFilter(epiSession.CompanyID, UserID, model).OrderBy(x => x.BuyerCode).ToList(); SetGrid(result); }