Пример #1
0
        public ActionResult AddMeal(int id, SelectedFoodModel model)
        {
            var    weight = model.Weight;
            string meal   = model.Meal;

            mealMenager.AddMeal(id, weight, meal);
            return(RedirectToAction("CreateDiet"));
        }
Пример #2
0
        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"));
        }