Exemplo n.º 1
0
        public ActionResult Edit(int id)
        {
            Meal meal = _mealServices.GetMeal(UserId, id);

            MealViewModel mealViewModel = Mapper.Map <Meal, MealViewModel>(meal);

            return(View(mealViewModel));
        }
Exemplo n.º 2
0
        public ActionResult UseMeal(int id, DateTime date)
        {
            Meal meal = _mealServices.GetMeal(UserId, id);

            foreach (Ingredient ingredient in meal.Ingredients)
            {
                _foodItemServices.InsertFoodItem(ingredient.Code, ingredient.Quantity, date, UserId);
            }

            var viewModel = GetFoodItemTableViewModel(date);

            return(PartialView("FoodItemTable", viewModel));
        }