Пример #1
0
 /// <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
 /// <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
 /// <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;
 }