Ejemplo n.º 1
0
        public string GetFoodById(int index)
        {
            using (FoodEntitie context = new FoodEntitie())
            {
                Food food =
                    context.Food.FirstOrDefault(x => x.FoodID == index);

                if (food == null)
                {
                    return(null);
                }

                return(food.FoodName);
            }
        }
Ejemplo n.º 2
0
        public byte[] GetById(int index, string imageType)
        {
            FoodImage foodImage;

            using (FoodEntitie context = new FoodEntitie())
            {
                foodImage =
                    context.FoodImage.FirstOrDefault(x => x.FoodID == index);

                if (foodImage == null)
                {
                    return(null);
                }
            }

            if (imageType == "Image")
            {
                return(foodImage.Image);
            }

            return(foodImage.Thumbnail);
        }