예제 #1
0
        public List <PetType> FindPetTypesByProperty(Filter filter)
        {
            IEnumerable <PetType> results;
            var list = _petTypeRepo.ReadAllPetTypes();

            switch (filter.Property)
            {
            case "name":
                results = list.Where(owner => owner.Name.ToLower().Contains(filter.Value));
                return(results.ToList());
            }
            return(null);   // Should never happen
        }
예제 #2
0
 public List <Pet> GetPetsByType(string type)
 {
     foreach (var petType in _petTypeRepo.ReadAllPetTypes())
     {
         if (!type.Equals(petType.GetType()))
         {
             throw new Exception("Please, enter a valid value for the Type");
         }
     }
     return(_petRepo.GetPetsByType(type));
 }
예제 #3
0
 public List <PetType> ReadAllPetTypes()
 {
     return(_petTypeRepo.ReadAllPetTypes());
 }
예제 #4
0
 public List<PetType> GetAllPetTypes()
 {
     return _petTypeRepository.ReadAllPetTypes().ToList();
 }