Beispiel #1
0
        public IActionResult AddReservation(ReservationPayload reservation)
        {
            Sensor sensor = _db.Sensors.FirstOrDefault(s => s.DeviceId == reservation.deviceId);

            if (sensor == null)
            {
                return(new StatusCodeResult(404));
            }
            Reservation newRes = new Reservation
            {
                ReservationStartUtc = DateTime.UtcNow,
                ReservationEndUtc   = DateTime.UtcNow.AddHours(reservation.hours),
                QRCode   = Guid.NewGuid().ToString(),
                Sensor   = sensor,
                UserName = reservation.userName
            };

            _db.Reservations.Add(newRes);
            _db.SaveChanges();
            return(Ok(newRes));
        }
Beispiel #2
0
 private void SendNotificationOneSignal(ReservationPayload payload)
 {
 }