public void DeleteSpecialEvent(SpecialEvent item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         var existing = context.SpecialEvents.Find(item.EventCode);
         context.SpecialEvents.Remove(existing);
         context.SaveChanges();
     }
 }
 public void AddSpecialEvent(SpecialEvent item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         // TODO: Validation rules...
         var added = context.SpecialEvents.Add(item);
         context.SaveChanges();
     }
 }
 public void UpdateSpecialEvent(SpecialEvent item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         //TODO: Validation...
         var attached = context.SpecialEvents.Attach(item);
         var existing = context.Entry<SpecialEvent>(attached);
         existing.State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
 public void UpdateEvent(SpecialEvent item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         //todo: Validation
         var attached = context.SpecialEvents.Attach(item);
         var matchingWithExistingValues = context.Entry<SpecialEvent>(attached);
         matchingWithExistingValues.State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
 public string AddEvent(SpecialEvent item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         //TODO: Validation of waiter data...
         var added = context.SpecialEvents.Add(item);
         context.SaveChanges();
         return added.EventCode;
     }
 }
 public void AddSpecialEvent(SpecialEvent item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         var added = context.SpecialEvents.Add(item);
         context.SaveChanges();
     }
 }