Exemplo n.º 1
0
        // C# 7 Synatx
        //public List<WorkoutSessionVM> GetAllWorkoutSessions(string userID) =>
        //    WorkoutSession
        //        .Where(i => i.UserId == userID)
        //        .Select(w => new WorkoutSessionVM
        //        {
        //            Date = w.Date,
        //            Distance = w.Distance,
        //            Duration = w.Duration,
        //            Exercises =
        //            w.Exercise.Select(
        //                z => new ExerciseVM
        //                {
        //                    Name = z.ExerciseName,
        //                    Sets = z.Set.Select(
        //                    q => new SetVM { Reps = q.Reps, UserComment = q.UserNote, Weight = Convert.ToInt32(q.UsedWeight) }).ToList()
        //                }).ToList()
        //        })
        //        .ToList();

        //Lägg till metoder

        internal List <ChooseExerciseVM> GetExercises()
        {
            return(UserExercises
                   .Where(c => c.UserId == "Admin")
                   .Select(s => new ChooseExerciseVM()
            {
                Name = s.Name, Type = s.Type
            }).ToList());
        }
Exemplo n.º 2
0
        private StatisicsVM GetPopularStrength(string userID)
        {
            var popularStrength = UserExercises
                                  .Where(t => t.UserId == userID && t.Type == "Strength")
                                  .Select(d => d.Name)
                                  .Count();

            StatisicsVM statToReturn = new StatisicsVM();

            statToReturn.TypeOfWorkoutSession = "General";

            statToReturn.Stats = new MostPopularStrength()
            {
                Name = popularStrength.ToString()
            };

            return(statToReturn);
        }