Beispiel #1
0
        public Guid RentScooter(Guid userId, int scooterId)
        {
            _scooterRepository.RentScooter(scooterId);
            var rental = new Rental(scooterId, userId, DateTime.Now, null, Guid.NewGuid());

            _rentalRepository.AddRental(rental);
            return(rental.RentalId);
        }
Beispiel #2
0
        public IActionResult RentScooter(int id, [FromBody] Customer customer)
        {
            var rented = _scooterRepository.RentScooter(id, customer.Id);

            if (!rented)
            {
                ModelState.AddModelError("", $"Scooter is not available or the Id you entered is wrong");
                return(StatusCode(500, ModelState));
            }
            return(Ok());
        }