Ejemplo n.º 1
0
        public FavouriteDish GetEntity(object id)
        {
            FavouriteDishKey key = (FavouriteDishKey)id;

            //return db.FavouriteDish.Include(x => x.Customer).Include(x => x.Dish)
            //    .SingleOrDefault(x => new { x.CustomerId, x.DishId } == id);
            return(db.FavouriteDish.Find(key.CustomerId, key.DishId));
        }
Ejemplo n.º 2
0
        public void Delete(object id)
        {
            FavouriteDishKey key           = (FavouriteDishKey)id;
            FavouriteDish    favouriteDish = db.FavouriteDish.Find(key.CustomerId, key.DishId);

            if (favouriteDish != null)
            {
                db.FavouriteDish.Remove(favouriteDish);
            }
        }