Ejemplo n.º 1
0
        public IActionResult OnGet(int category, int dayId, bool isremoved = false)
        {
            IsRemoved = isremoved;
            Category  = category;
            DayId     = dayId;

            if (dayId != 0)
            {
                Day = dayData.GetById(dayId);
            }

            if (IsRemoved)
            {
                Meals = (from m in dayMealData.GetAll()
                         where m.DayId == Day.DayId && m.Category == (MealCategory)Category
                         select m.Meal)
                        .ToList();
            }
            else
            {
                Meals = mealData.GetMealsByOwner(User.Identity.Name);
            }

            return(Page());
        }
Ejemplo n.º 2
0
 private void PresentTodayMeals()
 {
     TodayMeals = (from m in dayMealData.GetAll()
                   where m.DayId == Day.DayId
                   select new SimpleMeal
     {
         Name = m.Meal.Name,
         Kcal = m.Meal.Kcal,
         Protein = m.Meal.Protein,
         Carbohydrates = m.Meal.Carbohydrates,
         Fat = m.Meal.Fat,
         Fiber = m.Meal.Fiber,
         Category = m.Category
     })
                  .ToList();
 }