Example #1
0
        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());
        }
Example #2
0
        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());
        }
Example #3
0
        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"));
            }
        }