Пример #1
0
 public void Delete(HotelRoomSize entity)
 {
     if (entity != null)
     {
         using (var context = new HotelTamagotchiDBEntities())
         {
             context.Entry(entity).State = EntityState.Deleted;
             context.SaveChanges();
         }
     }
 }
 public void Edit(HotelRoom entity)
 {
     if (entity != null)
     {
         using (var context = new HotelTamagotchiDBEntities())
         {
             context.Entry(entity).State = EntityState.Modified;
             context.SaveChanges();
         }
     }
 }
Пример #3
0
 // Extra
 public void SetAllTamagotchiHotelRoomToNull(HotelBooking entity)
 {
     if (entity != null)
     {
         using (var context = new HotelTamagotchiDBEntities())
         {
             foreach (var tamagotchi in entity.Tamagotchis)
             {
                 tamagotchi.HotelBooking         = null;
                 tamagotchi.HotelRoomId          = null;
                 context.Entry(tamagotchi).State = EntityState.Modified;
                 context.SaveChanges();
             }
         }
     }
 }