public async Task <IActionResult> GetPaymentsByJourney(string userId, int journeyId, ResourceParameters resourceParameters) { if (!_journeyService.JourneyExists(userId, journeyId)) { return(NotFound()); } var pagedPayments = _paymentService.GetPagedPaymentsByJourneys(userId, journeyId, resourceParameters); AddPaginationHeader(pagedPayments, Constants.RouteNames.GetPaymentsByJourney, resourceParameters); await AddLinksToCollectionAsync(pagedPayments); return(Ok(pagedPayments)); }
public IActionResult DeleteJourney(string userId, int id) { if (!_journeyService.JourneyExists(userId, id)) { return(NotFound()); } _journeyService.DeleteJourney(userId, id); return(NoContent()); }
public async Task <IActionResult> GetPassengerRoutesByJourney(string userId, int journeyId, ResourceParameters resourceParameters) { // has to check if user exists for both, because journey is not connected with this particular user if (!_userService.UserExists(userId)) { return(NotFound()); } if (!_journeyService.JourneyExists(journeyId)) { return(NotFound()); } var pagedRoutes = _passengerRouteService.GetPagedRoutes(userId, journeyId, resourceParameters); AddPaginationHeader(pagedRoutes, Constants.RouteNames.GetPassengerRoutesByJourney, resourceParameters); var routesToReturn = pagedRoutes.ToList(); await AddLinksToCollectionAsync(routesToReturn); return(Ok(routesToReturn)); }