Ejemplo n.º 1
0
 public IHttpActionResult GetBookingWorkerLocations(int bookingId)
 {
     try
     {
         WalkingLocationToReturn locations = BookingService.GetBookingWorkerLocations(bookingId);
         return(Ok(locations));
     }
     catch (BookingNotFoundException ex)
     {
         return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message)));
     }
 }
Ejemplo n.º 2
0
        public WalkingLocationToReturn GetBookingWorkerLocations(int bookingId)
        {
            Booking booking = unitOfWork.BookingsRepository.GetByID(bookingId);

            validateBookingExists(booking);

            int    workerId        = booking.WorkerId;
            Worker workerOfBooking = unitOfWork.WorkerRepository.GetByID(workerId);

            Location initialL = booking.InitialLocation;
            Location currentL = workerOfBooking.Location;
            WalkingLocationToReturn workerLocations = new WalkingLocationToReturn(initialL.Latitude, initialL.Longitude, currentL.Latitude, currentL.Longitude);

            return(workerLocations);
        }