///Takes a FilterModel with SearchTerm and SearchValue public ActionResult <List <PetType> > Get([FromQuery] FilterModel filter) { if (string.IsNullOrEmpty(filter.SearchTerm) && string.IsNullOrEmpty(filter.SearchValue)) { try { List <PetType> allTheTypes = _petTypeService.GetALlPetTypes(); if (allTheTypes.Count < 1) { return(NotFound("I am sorry it seems there are no PetTypes.")); } else { return(Ok(allTheTypes)); } } catch (Exception e) { return(StatusCode(500, e.Message)); } } else { if (string.IsNullOrEmpty(filter.SearchTerm) || string.IsNullOrEmpty(filter.SearchValue)) { return(BadRequest("You need to enter both a SearchTerm and a SearchValue")); } else { try { List <PetType> allTheTypes = _petTypeService.SearchPetType(filter); if (allTheTypes.Count < 1 || allTheTypes == null) { return(NotFound("I am sorry could not find any petTypes with those parameters.")); } else { return(Ok(allTheTypes)); } } catch (Exception e) { return(StatusCode(500, e.Message)); } } } }