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 })); }
// GET api/<controller>/5 public string Get(string Id) { return(_food.GetFood(Id)); }
public void Eat() { string result = _food.GetFood(); Console.WriteLine($"我想吃{result}"); }
public IEnumerable <Food> GetFood() { var foods = ifood.GetFood(); return(foods); }