public int AddTable(Table item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         var added = context.Tables.Add(item);
         context.SaveChanges();
         return added.TableID;
     }
 }
 public int AddTable(Table item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         //TODO: Validation of waiter data
         var added = context.Tables.Add(item);
         context.SaveChanges();
         return added.TableID;
     }
 }
 public void UpdateTable(Table item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         //TODO: Validation
         var attached = context.Tables.Attach(item);
         var matchingWithExistingValues = context.Entry<Table>(attached);
         matchingWithExistingValues.State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
 public void DeleteWaiter(Table item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         var existing = context.Tables.Find(item.TableID);
         context.Tables.Remove(existing);
         context.SaveChanges();
     }
 }
 public void UpdateTable(Table item)
 {
     //TODO: Validation rules...
     using (RestaurantContext context = new RestaurantContext())
     {
         var attached = context.Tables.Attach(item);
         var existing = context.Entry<Table>(attached);
         existing.State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }