public async Task <IActionResult> GetLostDogs([FromQuery(Name = "filter")] LostDogFilter filter, [FromQuery] string sort, [FromQuery] int page = 0, [FromQuery] int size = 10) { var serviceResponse = await lostDogService.GetLostDogs(filter, sort, page, size); var controllerResponse = mapper.Map <ControllerResponse <List <GetLostDogDto>, int> >(serviceResponse); return(StatusCode(serviceResponse.StatusCode, controllerResponse)); }
public async void GettingLostDogsForUserOneSuccessful(int userId) { var filter = new LostDogFilter() { OwnerId = userId }; var result = await lostDogRepository.GetLostDogs(filter, null, 0, 10); Assert.True(result.Successful); }
public async Task <ServiceResponse <List <GetLostDogDto>, int> > GetLostDogs(LostDogFilter filter, string sort, int page, int size) { var repoResponse = await lostDogDataRepository.GetLostDogs(filter, sort, page, size); var serviceResponse = mapper.Map <RepositoryResponse <List <LostDog>, int>, ServiceResponse <List <GetLostDogDto>, int> >(repoResponse); if (!serviceResponse.Successful) { serviceResponse.StatusCode = StatusCodes.Status400BadRequest; } return(serviceResponse); }