Ejemplo n.º 1
0
        public List <HUTModels.Ingredient> GetPerRecipe(int recipeId)
        {
            List <HUTModels.Ingredient> ingredients = repo.Get <HUTDataAccessLayerSQL.Ingredient>()
                                                      .Select(x => new HUTModels.Ingredient()
            {
                FoodId       = x.FoodId,
                IngredientId = x.IngredientId,
                RecipeId     = x.RecipeId,
                Weight       = x.Weight
            })
                                                      .Where(y => y.RecipeId == recipeId)
                                                      .OrderByDescending(z => z.Weight)
                                                      .ToList();

            return(ingredients);
        }
Ejemplo n.º 2
0
        public List <HUTModels.CalorieCountOffDay> GetDaysOffInDateRange(int personId, DateTime startDate, DateTime endDate)
        {
            List <HUTModels.CalorieCountOffDay> counts = repo.Get <CalorieCountOffDay>(c => c.PersonId == personId &&
                                                                                       c.DateEntered >= startDate.Date &&
                                                                                       c.DateEntered <= endDate.Date,
                                                                                       orderBy: o => o.OrderBy(c => c.DateEntered)
                                                                                       )
                                                         .Select(x => new HUTModels.CalorieCountOffDay()
            {
                CalorieCountOffDayId = x.CalorieCountOffDayId,
                PersonId             = x.PersonId,
                DateEntered          = x.DateEntered.Date
            })
                                                         .ToList();

            return(counts);
        }
Ejemplo n.º 3
0
        public List <HUTModels.Weight> GetByDateRange(int personId, DateTime startDate, DateTime endDate)
        {
            List <HUTModels.Weight> weight = repo.Get <Weight>(w => w.PersonId == personId &&
                                                               w.DateEntered >= startDate.Date &&
                                                               w.DateEntered <= endDate.Date,
                                                               orderBy: o => o.OrderBy(w => w.DateEntered)
                                                               )
                                             .Select(x => new HUTModels.Weight()
            {
                WeightId     = x.WeightId,
                PersonId     = x.PersonId,
                DateEntered  = x.DateEntered,
                WeightAmount = x.WeightAmount
            })
                                             .ToList();

            return(weight);
        }
Ejemplo n.º 4
0
        public List <HUTModels.CalorieCount> GetByDateRange(int personId, DateTime startDate, DateTime endDate)
        {
            List <HUTModels.CalorieCount> counts = repo.Get <CalorieCount>(c => c.PersonId == personId &&
                                                                           c.DatetimeEntered >= startDate.Date &&
                                                                           c.DatetimeEntered <= endDate.Date,
                                                                           orderBy: o => o.OrderBy(c => c.DatetimeEntered)
                                                                           )
                                                   .Select(x => new HUTModels.CalorieCount()
            {
                CalorieCountId  = x.CalorieCountId,
                PersonId        = x.PersonId,
                DatetimeEntered = x.DatetimeEntered,
                Calories        = x.Calories
            })
                                                   .ToList();

            return(counts);
        }
Ejemplo n.º 5
0
        public List <HUTModels.Size> GetByDateRange(int personId, DateTime startDate, DateTime endDate)
        {
            List <HUTModels.Size> sizes = repo.Get <Size>(s => s.PersonId == personId &&
                                                          s.DateEntered >= startDate.Date &&
                                                          s.DateEntered <= endDate.Date,
                                                          orderBy: o => o.OrderBy(s => s.DateEntered)
                                                          )
                                          .Select(x => new HUTModels.Size()
            {
                SizeId      = x.SizeId,
                PersonId    = x.PersonId,
                DateEntered = x.DateEntered,
                Bicep       = x.Bicep,
                Stomach     = x.Stomach
            })
                                          .ToList();

            return(sizes);
        }