private void buttonFind_Click(object sender, EventArgs e) { FindEstateDto searchObj = new FindEstateDto(); searchObj.EstateId = textBoxFindEstateId.Text; searchObj.LegalForm = (LegalForm)comboBoxLegalForm.SelectedItem; searchObj.Type = (Estate)comboBoxType.SelectedItem; searchObj.Category = (Estate)comboBoxCategory.SelectedItem; searchObj.Street = textBoxFindStreet.Text; searchObj.ZipCode = textBoxFindZipcode.Text; searchObj.City = textBoxFindCity.Text; searchObj.Country = (Countries)comboBoxCountry.SelectedItem; var result = _estateController.SearchEstate(searchObj); dataGridViewEstates.DataSource = result; }
public List <Estate> SearchEstate(FindEstateDto estate) { List <Estate> allEstates = _estateManager.GetAll(); var result = from e in allEstates where e.GetType().Equals(estate.Category.GetType()) || e.GetType().Equals(estate.GetType()) || e.Address.Street == estate.Street || e.Address.ZipCode == estate.ZipCode || e.Address.City == estate.City || e.Address.Country == estate.Country || e.LegalForm == estate.LegalForm || e.EstateId == estate.EstateId select e; return(result.ToList()); }