public Ingredient GetWholeEntity(object id) { IngredientKey key = (IngredientKey)id; return(db.Ingredient.Include(x => x.Product) .SingleOrDefault(x => x.ProductId == key.ProductId & x.DishId == key.DishId));; }
public Ingredient GetEntity(object id) { IngredientKey key = (IngredientKey)id; return(db.Ingredient .Find(key.DishId, key.ProductId)); }
public void Delete(object id) { IngredientKey key = (IngredientKey)id; Ingredient ingredient = db.Ingredient.Find(key.DishId, key.ProductId); if (ingredient != null) { db.Ingredient.Remove(ingredient); } }