public ActionResult <IEnumerable <BookingAdapterOut> > Get([FromQuery] long start, long end, int productId) { try { List <BookingOrder> bookings; if (start == 0 && end == 0) { bookings = _bookingService.ReadAll(); } else { bookings = _bookingService.ReadByWeek(DateConverter.FromUTCEpochToDatetime(start), DateConverter.FromUTCEpochToDatetime(end), productId); } List <BookingAdapterOut> bookingsOut = new List <BookingAdapterOut>(); foreach (BookingOrder item in bookings) { bookingsOut.Add(new BookingAdapterOut { Id = item.Id, Product = item.Product, User = item.User, StartTimeOfBooking = DateConverter.FromDatetimeToUTCEpoch(item.StartTimeOfBooking), EndTimeOfBooking = DateConverter.FromDatetimeToUTCEpoch(item.EndTimeOfBooking) }); } return(Ok(bookings)); } catch (Exception e) { return(BadRequest(e.Message)); } }