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