本文整理汇总了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;
}
}
示例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();
}
}
示例3: AddSpecialEvent
public void AddSpecialEvent(SpecialEvent item)
{
using (RestaurantContext context = new RestaurantContext())
{
// TODO: Validation rules...
var added = context.SpecialEvents.Add(item);
context.SaveChanges();
}
}
示例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();
}
}
示例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();
}
}
示例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;
}
}
示例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();
}
}
示例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;
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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;
}
}
示例15: AddReservation
public void AddReservation(Reservation item)
{
using (RestaurantContext context = new RestaurantContext())
{
var added = context.Reservations.Add(item);
context.SaveChanges();
}
}