Ejemplo n.º 1
0
        public async Task <ActionResult> Index(DateTime?t)
        {
            var date = t ?? Clock.Now;

            var meals       = (await _mealService.GetAll(new PagedAndSortedResultRequestDto {
                MaxResultCount = int.MaxValue
            })).Items;
            var dayMeals    = meals.Where(m => m.Date.Date == date.Date).ToList();
            var ingredients = (await _ingredientService.GetAll(new PagedAndSortedResultRequestDto {
                MaxResultCount = int.MaxValue
            })).Items;
            //var users = (await _userAppService.GetAll(new PagedResultRequestDto { MaxResultCount = int.MaxValue })).Items; //Paging not implemented yet
            //var roles = (await _userAppService.GetRoles()).Items;
            var vm = new MealListViewModel()
            {
                Meals       = dayMeals,
                Day         = date,
                Ingredients = ingredients
            };

            //var meals = db.Meals.Include(m => m.User);
            return(View(vm));
        }
Ejemplo n.º 2
0
        // GET: Ingredients
        public async Task <ActionResult> Index()
        {
            var ingredients = (await _ingredientService.GetAll(new PagedAndSortedResultRequestDto {
                MaxResultCount = int.MaxValue
            })).Items;
            var facts       = (await _nutritionFactService.GetAllDefault()).Items;

            var vm = new IngredientListViewModel()
            {
                Ingredients    = ingredients,
                NutritionFacts = facts
            };

            return(View(vm));
        }
Ejemplo n.º 3
0
        // GET: Ingredients
        public async Task <ActionResult> Index()
        {
            var ingredients = (await _ingredientService.GetAll(new PagedAndSortedResultRequestDto {
                MaxResultCount = int.MaxValue
            })).Items
                              .Where(i => i.Status == ApprovalStatus.Pending).ToList(); // TODO: move to appservice
            var facts = (await _nutritionFactService.GetAllDefault()).Items;

            var vm = new IngredientListViewModel()
            {
                Ingredients    = ingredients,
                NutritionFacts = facts
            };

            return(View(vm));
        }