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);
 }
Exemple #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);
 }