示例#1
0
        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));;
        }
示例#2
0
        public Ingredient GetEntity(object id)
        {
            IngredientKey key = (IngredientKey)id;

            return(db.Ingredient
                   .Find(key.DishId, key.ProductId));
        }
示例#3
0
        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);
            }
        }