Пример #1
0
 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
     };
 }
Пример #2
0
        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;
        }