public IActionResult GetShelter(int shelterId) { var shelter = shelterRepo.GetShelter(shelterId); if (shelter == null) { return(NotFound()); } else { return(Ok(mapper.Map <ShelterDto>(shelter))); } }
public async Task <ServiceResponse <ShelterDto> > GetShelter(int id) { var repoResponse = await shelterRepository.GetShelter(id); var serviceResponse = mapper.Map <RepositoryResponse <Shelter>, ServiceResponse <ShelterDto> >(repoResponse); if (!serviceResponse.Successful) { serviceResponse.StatusCode = StatusCodes.Status400BadRequest; } return(serviceResponse); }
public async void GetShelterFailsForNotExistingShelter() { var result = await shelterRepository.GetShelter(-1); Assert.False(result.Successful); }
public IEnumerable <Shelter> GetShelter() { return(_repository.GetShelter()); }