public ActionResult <MealItem> getMealItem(int id) { // get the meal Item from the datebase MealItem item = mealDB.getMealItem(id); // if this item not found if (item == null) { // retern message Notfound return(NotFound($"No MealItem found for id: {id}")); } // else return this item else { return(Ok(item)); } }
/// <summary> /// Creates the meunItem output for menu from the String /// </summary> /// <param name="item"></param> /// <returns></returns> private MenuItem ConvertFromStringToMenuItem(string line) { string[] args = line.Split(";"); MenuItem item = new MenuItem { MenuID = Convert.ToInt32(args[0]), Meal = mealDB.getMealItem(Convert.ToInt32(args[1])), Price = decimal.Parse(args[2]), Date = DateTime.Parse(args[3]).Date }; return(item); }