//public IActionResult FindNutritionItem(string SearchString) //{ // return View(); //} //[HttpPost] public async Task <IActionResult> FindNutritionItem([FromServices] NutritionixService nutritionixService, string SearchString) { // SearchString = "mcdouble"; NutritionixFoodItem nutritionixFoodItem = await nutritionixService.GetSearchedNutritionItem(SearchString); SearchedFood foodReturned = new SearchedFood(); foodReturned.Name = nutritionixFoodItem.hits[0].fields.item_name; foodReturned.BrandName = nutritionixFoodItem.hits[0].fields.brand_name; foodReturned.Calories = (int)nutritionixFoodItem.hits[0].fields.nf_calories; foodReturned.ServingSize = nutritionixFoodItem.hits[0].fields.nf_serving_size_qty; return(View(foodReturned)); }
public Health_EnthusiastController(ApplicationDbContext context, NutritionixService nutritionixService) { _context = context; _nutritionixService = nutritionixService; }
public NutritionixController(ApplicationDbContext context, NutritionixService nutritionixService) { _context = context; _nutritionixService = nutritionixService; }