public async Task <int> CalculaCaloriesPerPortion(int mealId, int grams) { var incomingMeal = await _repoDailyMeal.GetExternalDailyMeal(mealId); int fullportion = incomingMeal.nutrition.weightPerServing.amount; var totalcalories = incomingMeal.nutrition.nutrients.ToList()[0].amount; return(Convert.ToInt32((totalcalories * grams) / fullportion)); }
public async Task <IActionResult> GetSingleDailyMealDetails(int id) { var dMealLocal = await _repoUser.GetDailyMealAsync(id); if (dMealLocal != null) { var incomMeal = await _repoUser.GetExternalDailyMeal(id); (Models.DailyMeal dMeal, ExternalModels.IncomingRecipe iRecipe) = (dMealLocal, incomMeal); return(Ok((dMealLocal, incomMeal))); } return(NotFound()); }