Пример #1
0
 public bool Delete(int foodID)
 {
     try
     {
         _dbContext.Remove(_dbContext.Foods.Single(f => f.FoodID == foodID));
         _dbContext.SaveChanges();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
     return(true);
 }
Пример #2
0
 public bool Delete(int categoryID)
 {
     try
     {
         _dbContext.Remove(_dbContext.Categories.Single(c => c.CategoryID == categoryID));
         _dbContext.SaveChanges();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
     return(true);
 }