Exemplo n.º 1
0
 protected void OnContextDisposing(object sender, EntityDataSourceContextDisposingEventArgs e)
 {
     if (data != null)
     {
         data.Dispose();
         data = null;
     }
 }
Exemplo n.º 2
0
 protected void OnContextCreating(object sender, EntityDataSourceContextCreatingEventArgs e)
 {
     if (data == null)
     {
         data = new RoomReservationEntities();
     }
     e.Context = data;
 }
Exemplo n.º 3
0
 public void UpdateReservation(Reservation reservation)
 {
     using (RoomReservationEntities data = new RoomReservationEntities())
     {
         data.Reservations.Attach(reservation);
         data.ObjectStateManager.ChangeObjectState(reservation, EntityState.Modified);
         data.SaveChanges();
     }
 }
Exemplo n.º 4
0
        public IEnumerable <MeetingRoom> MeetingRooms()
        {
            IEnumerable <MeetingRoom> rooms;

            using (RoomReservationEntities data = new RoomReservationEntities())
            {
                rooms = data.MeetingRooms.ToList();
            }
            return(rooms);
        }
Exemplo n.º 5
0
        public IEnumerable <Reservation> GetReservationsByRoom(int roomId)
        {
            IEnumerable <Reservation> reservations;

            using (RoomReservationEntities data = new RoomReservationEntities())
            {
                reservations = data.Reservations.Where(r => r.RoomId == roomId).ToList();
            }
            return(reservations);
        }