public EditReservationViewModel(Reservation reservation)
     : base()
 {
     this.reservation = reservation;
     context.Reservations.Where(res => res.Id == reservation.Id).Load();
     context.Locations.Load();
 }
 public int addReservation(Reservation newReservation)
 {
     int overlappingReservations = context.Reservations.Where(res => (newReservation.StartDate < res.EndDate && newReservation.EndDate > res.EndDate) ||
        (newReservation.EndDate > res.StartDate && newReservation.StartDate < res.EndDate) ||
        (newReservation.StartDate > res.StartDate && newReservation.EndDate < res.EndDate) ||
        (newReservation.StartDate < res.StartDate && newReservation.EndDate > res.EndDate)).Count();
     if (overlappingReservations == 0)
     {
         if (newReservation.StartDate < newReservation.EndDate)
         {
             context.Reservations.Add(newReservation);
             return context.SaveChanges();
         }
         else
         {
             return 0;
         }
     }
     else
     {
         return 0;
     }
 }
 public int removeReservation(Reservation reservation)
 {
     context.Reservations.Remove(reservation);
     return context.SaveChanges();
 }