当前位置: 首页>>代码示例>>C#>>正文


C# RestaurantContext.SaveChanges方法代码示例

本文整理汇总了C#中eRestaurant.DAL.RestaurantContext.SaveChanges方法的典型用法代码示例。如果您正苦于以下问题:C# RestaurantContext.SaveChanges方法的具体用法?C# RestaurantContext.SaveChanges怎么用?C# RestaurantContext.SaveChanges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eRestaurant.DAL.RestaurantContext的用法示例。


在下文中一共展示了RestaurantContext.SaveChanges方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddTable

 public int AddTable(Table item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         var added = context.Tables.Add(item);
         context.SaveChanges();
         return added.TableID;
     }
 }
开发者ID:rsxlancer,项目名称:DMIT2018-In-Class,代码行数:9,代码来源:RestaurantAdminController.cs

示例2: DeleteSpecialEvent

 public void DeleteSpecialEvent(SpecialEvent item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         var existing = context.SpecialEvents.Find(item.EventCode);
         context.SpecialEvents.Remove(existing);
         context.SaveChanges();
     }
 }
开发者ID:Eirikson,项目名称:In-Class-A02,代码行数:9,代码来源:RestaurantAdminController.cs

示例3: AddSpecialEvent

 public void AddSpecialEvent(SpecialEvent item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         // TODO: Validation rules...
         var added = context.SpecialEvents.Add(item);
         context.SaveChanges();
     }
 }
开发者ID:Eirikson,项目名称:In-Class-A02,代码行数:9,代码来源:RestaurantAdminController.cs

示例4: DeleteItem

 public void DeleteItem(Item item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         var existing = context.Items.Find(item.ItemID);
         context.Items.Remove(existing);
         context.SaveChanges();
     }
 }
开发者ID:Eirikson,项目名称:In-Class-A02,代码行数:9,代码来源:RestaurantAdminController.cs

示例5: DeleteWaiter

 public void DeleteWaiter(Waiter item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         var existing = context.Waiters.Find(item.WaiterID);
         context.Waiters.Remove(existing);
         context.SaveChanges();
     }
 }
开发者ID:Bbyrne6,项目名称:In-Class,代码行数:9,代码来源:RestaurantAdminController.cs

示例6: AddItem

 public int AddItem(Item item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         // TODO: Validation rules...
         var added = context.Items.Add(item);
         context.SaveChanges();
         return added.ItemID;
     }
 }
开发者ID:Eirikson,项目名称:In-Class-A02,代码行数:10,代码来源:RestaurantAdminController.cs

示例7: UpdateWaiter

 public void UpdateWaiter(Waiters item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         var attached = context.Waiters.Attach(item);
         var existing = context.Entry<Waiters>(attached);
         existing.State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
开发者ID:tciarroni,项目名称:eRestaurant-Sample,代码行数:10,代码来源:RestaurantAdminController.cs

示例8: AddWaiter

 public int AddWaiter(Waiter item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         // TODO: Validation rules...
         var added = context.Waiters.Add(item);
         context.SaveChanges();
         return added.WaiterID;
     }
 }
开发者ID:Bbyrne6,项目名称:In-Class,代码行数:10,代码来源:RestaurantAdminController.cs

示例9: UpdateWaiter

 public void UpdateWaiter(Waiter item)
 {        
     using (RestaurantContext context = new RestaurantContext())
     {
         //TODO: Validation
         var attached = context.Waiters.Attach(item);
         var matchingWithExistingValues = context.Entry<Waiter>(attached);
         matchingWithExistingValues.State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
开发者ID:mmayo2,项目名称:DMIT2018InClass,代码行数:11,代码来源:RestaurantAdminController.cs

示例10: UpdateTable

 public void UpdateTable(Table item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         //TODO: Validation...
         var attached = context.Tables.Attach(item);
         var existing = context.Entry<Table>(attached);
         existing.State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
开发者ID:punq,项目名称:DMIT2018inclass,代码行数:11,代码来源:RestaurantAdminController.cs

示例11: DeleteTable

 public void DeleteTable(Table item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         var existing = context.Tables.Find(item.TableID);
         context.Tables.Remove(existing);
         context.SaveChanges();
     }
 }
开发者ID:mmayo2,项目名称:DMIT2018InClass,代码行数:9,代码来源:RestaurantAdminController.cs

示例12: UpdateTable

 public void UpdateTable(Table item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         var attached = context.Tables.Attach(item);
         var matchingWithExistedValues = context.Entry<Table>(attached);
         matchingWithExistedValues.State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
开发者ID:rsxlancer,项目名称:DMIT2018-In-Class,代码行数:10,代码来源:RestaurantAdminController.cs

示例13: DeleteReservation

 public void DeleteReservation(Reservation item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         var existing = context.Reservations.Find(item.EventCode);
         context.Reservations.Remove(existing);
         context.SaveChanges();
     }
 }
开发者ID:mklause1,项目名称:DMIT2018-In-Class,代码行数:9,代码来源:RestaurantAdminController.cs

示例14: AddEvent

 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;
     }
 }
开发者ID:rsxlancer,项目名称:DMIT2018-In-Class,代码行数:10,代码来源:RestaurantAdminController.cs

示例15: AddReservation

 public void AddReservation(Reservation item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         var added = context.Reservations.Add(item);
         context.SaveChanges();
     }
 }
开发者ID:mklause1,项目名称:DMIT2018-In-Class,代码行数:8,代码来源:RestaurantAdminController.cs


注:本文中的eRestaurant.DAL.RestaurantContext.SaveChanges方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。