示例#1
0
文件: WineBLL.cs 项目: blel/ebalit
 /// <summary>
 /// Delete a wine
 /// </summary>
 /// <param name="wine"></param>
 public void DeleteWine(Wine wine)
 {
     var wineToDelete = GetWineById(wine.Id);
     if (wineToDelete != null)
     {
         base.EbalitDBContext.Wines.Remove(wineToDelete);
         base.EbalitDBContext.SaveChanges();
     }
 }
示例#2
0
文件: WineBLL.cs 项目: blel/ebalit
 /// <summary>
 /// Update a wine
 /// </summary>
 /// <param name="wine"></param>
 public void UpdateWine(Wine wine)
 {
     var wineToUpdate = GetWineById(wine.Id);
     if (wineToUpdate != null)
     {
         base.EbalitDBContext.Entry(wineToUpdate).CurrentValues.SetValues(wine);
         base.EbalitDBContext.SaveChanges();
     }
 }
示例#3
0
文件: WineBLL.cs 项目: blel/ebalit
 /// <summary>
 /// Insert a new wine
 /// </summary>
 /// <param name="wine">the wine</param>
 /// <returns></returns>
 public int CreateWine(Wine wine)
 {
     base.EbalitDBContext.Wines.Add(wine);
     base.EbalitDBContext.SaveChanges();
     return wine.Id;
 }