public ActionResult AddMeal(int id, SelectedFoodModel model) { var weight = model.Weight; string meal = model.Meal; mealMenager.AddMeal(id, weight, meal); return(RedirectToAction("CreateDiet")); }
public async Task <ActionResult> AddMeal(int id, SelectedFoodModel model) { var weight = model.Weight; string meal = model.Meal; try { var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); var userWeight = user.UserData.Weight; var userHeight = user.UserData.Height; var userAge = user.UserData.Age; var userSex = user.UserData.Sex; mealMenager.AddMeal(id, weight, meal, userWeight, userHeight, userAge, userSex); } catch (Exception ex) { return(HttpNotFound()); } return(RedirectToAction("CreateDiet")); }