Пример #1
0
        public void Reservations_Update(Reservations item)
        {
            using (eRestaurantContext context = new eRestaurantContext())
            {
                context.Entry<Reservations>(context.Reservations.Attach
                (item)).State = System.Data.Entity.EntityState.Modified;

                context.SaveChanges();
            }
        }
Пример #2
0
 public void Reservations_Delete(Reservations item)
 {
     using (eRestaurantContext context = new eRestaurantContext())
     {
         Reservations existing = context.Reservations.Find(item.ReservationID);
         context.Reservations.Remove(existing);
         context.SaveChanges();
     }
 }
Пример #3
0
 public void Reservations_Add(Reservations item)
 {
     using (eRestaurantContext context = new eRestaurantContext())
     {
         Reservations added = null;
         added = context.Reservations.Add(item);
         context.SaveChanges();                                                  //Commits the add to the database.
         //Furthermore, this evaluates the annotations (validates) on the entity.
         //Included: [Required], [StringLength], [Range], etc.
     }
 }