public async Task <ActionResult <PagedResponse <EmployerVacanciesDto> > > GetAllSubscriptionVacanciesGroupedByCompany( int subscriptionId, [FromQuery] GetAllSubscriptionVacanciesQuery query, [FromQuery] PaginationQuery paginationQuery) { try { var paginationFilter = _mapper.Map <PaginationFilter>(paginationQuery); var queryFilter = _mapper.Map <GetAllSubscriptionVacanciesFilter>(query); var pagedVacancies = await _subscriptionVacancyService.GetSubscriptionVacanciesGroupByCompanyAsync(subscriptionId, queryFilter, paginationFilter); var groupedResponse = pagedVacancies.ToGroupedVacancies(_mapper); return(Ok(groupedResponse)); } catch (SubscriptionVacancyValidationException exception) when(exception.InnerException is NotFoundSubscriptionException) { var innerMessage = GetInnerMessage(exception); return(NotFound(innerMessage)); } catch (SubscriptionVacancyValidationException exception) { var innerMessage = GetInnerMessage(exception); return(BadRequest(innerMessage)); } catch (SubscriptionVacancyServiceException exception) { return(Problem(exception.Message)); } }
public async Task <ActionResult <PagedResponse <SubscriptionVacancyDto> > > GetAllSubscriptionVacancies( int subscriptionId, [FromQuery] GetAllSubscriptionVacanciesQuery query, [FromQuery] PaginationQuery paginationQuery, [FromQuery] SortByQuery sortByQuery) { try { var paginationFilter = _mapper.Map <PaginationFilter>(paginationQuery); var queryFilter = _mapper.Map <GetAllSubscriptionVacanciesFilter>(query); var sortByOption = _mapper.Map <SortByOptions>(sortByQuery); var pagedVacancies = await _subscriptionVacancyService.GetSubscriptionVacanciesAsync(subscriptionId, queryFilter, paginationFilter, sortByOption); var vacanciesResponse = _mapper.Map <PagedResponse <SubscriptionVacancyDto> >(pagedVacancies); return(Ok(vacanciesResponse)); } catch (SubscriptionVacancyValidationException exception) when(exception.InnerException is NotFoundSubscriptionException) { var innerMessage = GetInnerMessage(exception); return(NotFound(innerMessage)); } catch (SubscriptionVacancyValidationException exception) { var innerMessage = GetInnerMessage(exception); return(BadRequest(innerMessage)); } catch (SubscriptionVacancyServiceException exception) { return(Problem(exception.Message)); } }