示例#1
0
        public IActionResult GetShelter(int shelterId)
        {
            var shelter = shelterRepo.GetShelter(shelterId);

            if (shelter == null)
            {
                return(NotFound());
            }
            else
            {
                return(Ok(mapper.Map <ShelterDto>(shelter)));
            }
        }
示例#2
0
        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());
 }