public ActionResult <IEnumerable <Food> > Get(int?categoryID)
        {
            IEnumerable <Food> foods = _foodService.GetFood(categoryID);

            if (foods.Count() != 0)
            {
                return(Ok(new { data = foods, message = "Success", status = true }));
            }
            return(Ok(new { data = foods, message = "No data available", status = true }));
        }
示例#2
0
 // GET api/<controller>/5
 public string Get(string Id)
 {
     return(_food.GetFood(Id));
 }
        public void Eat()
        {
            string result = _food.GetFood();

            Console.WriteLine($"我想吃{result}");
        }
示例#4
0
        public IEnumerable <Food> GetFood()
        {
            var foods = ifood.GetFood();

            return(foods);
        }