Пример #1
0
        public FoodStyleProduct GetWholeEntity(object id)
        {
            FoodStyleProductKey key = (FoodStyleProductKey)id;

            return(db.FoodStyleProduct.Include(x => x.FoodStyle).Include(x => x.Product)
                   .SingleOrDefault(x => x.FoodStyleId == key.FoodStyleId
                                    & x.ProductId == key.ProductId));
        }
Пример #2
0
        public FoodStyleProduct GetEntity(object id)
        {
            FoodStyleProductKey key = (FoodStyleProductKey)id;

            //return db.FoodStyleProduct.Include(x => x.FoodStyle).Include(x => x.Product)
            //    .SingleOrDefault(x => new { x.FoodStyleId, x.ProductId } == id);
            return(db.FoodStyleProduct.Find(key.FoodStyleId, key.ProductId));
        }
Пример #3
0
        public void Delete(object id)
        {
            FoodStyleProductKey key = (FoodStyleProductKey)id;
            FoodStyleProduct    foodStyleProduct = db.FoodStyleProduct
                                                   .Find(key.FoodStyleId, key.ProductId);

            if (foodStyleProduct != null)
            {
                db.FoodStyleProduct.Remove(foodStyleProduct);
            }
        }