public async Task <IActionResult> SetRideAsInactive([FromBody] RideDto rideDto) { var userDto = await _userRepository.GetLoggedInUser(User); if (rideDto == null) { return(BadRequest()); } _passengerLogic.RemovePassengerByRide(rideDto.RideId); _rideRequestLogic.DeletedRide(rideDto.RideId); _rideLogic.SetRideAsInactive(rideDto); return(Ok()); }
public async Task <IActionResult> SetRideAsInactive([FromBody] List <RideDto> rides) { foreach (var rideDto in rides) { await ValidateDriverAsync(rideDto.RideId); var userDto = await _userLogic.GetLoggedInUser(); if (rideDto == null) { return(BadRequest()); } _passengerLogic.RemovePassengerByRide(rideDto.RideId); _rideRequestLogic.DeletedRide(rideDto.RideId); _rideLogic.SetRideAsInactive(rideDto); } return(Ok()); }
public async Task <IActionResult> SetRideAsInactive([FromBody] RideDto rideDto) { var userDto = await _userRepository.GetLoggedInUser(User); if (rideDto == null) { return(BadRequest("invalid parameter")); } _rideRequestLogic.DeletedRide(rideDto.RideId); bool result = _rideLogic.SetRideAsInactive(rideDto); if (result) { return(Ok()); } else { return(BadRequest("Operation failed")); } }