public PharmacyDto ToDto(Pharmacy pharmacy) { var address = pharmacy.Address != null ? pharmacy.Address.Street + " " + pharmacy.Address.HouseNumber + " " + pharmacy.Address.PostalCode + " " + pharmacy.Address.City : ""; return new PharmacyDto { ID = pharmacy.Id, Name = pharmacy.Name, Address = address, Phone = pharmacy.Phone, Description = pharmacy.Description }; }
public bool IsMatch(Pharmacy pharmacy) { if (!ById.HasValue && string.IsNullOrEmpty(ByAddress) && string.IsNullOrEmpty(ByName)) return true; var address = pharmacy.Address != null ? pharmacy.Address.Street + " " + pharmacy.Address.HouseNumber + " " + pharmacy.Address.PostalCode + " " + pharmacy.Address.City : ""; if (ById.HasValue && pharmacy.Id == ById.Value || !string.IsNullOrEmpty(ByName) && pharmacy.Name.ToLower().Contains(ByName.ToLower()) || !string.IsNullOrEmpty(ByAddress) && address.ToLower().Contains(ByAddress.ToLower())) return true; return false; }