public void WorkoutAchievementsCheck(Workout WorkoutViewModel) { var user = Users.GetUser(WorkoutViewModel.UserId); var AchievementsList = Achievements.GetAllAchievement(WorkoutViewModel.UserId); var WorkoutList = Workouts.GetAllWorkouts(WorkoutViewModel.UserId); var Achievement = AchievementsList.First(a => a.Name == "Pierwszy trenig siłowy"); if (WorkoutList.Any() && !Achievement.Acquired) { AcceptAchievement(Achievement, WorkoutViewModel.Date, user); } Achievement = AchievementsList.FirstOrDefault(a => a.Name == "10 trenigów siłowych"); if (WorkoutList.Count() >= 10 && !Achievement.Acquired) { AcceptAchievement(Achievement, WorkoutViewModel.Date, user); } Achievement = AchievementsList.FirstOrDefault(a => a.Name == "20 trenigów siłowych"); if (WorkoutList.Count() >= 20 && !Achievement.Acquired) { AcceptAchievement(Achievement, WorkoutViewModel.Date, user); } Achievement = AchievementsList.FirstOrDefault(a => a.Name == "50 trenigów siłowych"); if (WorkoutList.Count() >= 50 && !Achievement.Acquired) { AcceptAchievement(Achievement, WorkoutViewModel.Date, user); } Achievement = AchievementsList.FirstOrDefault(a => a.Name == "100 trenigów siłowych"); if (WorkoutList.Count() >= 100 && !Achievement.Acquired) { AcceptAchievement(Achievement, WorkoutViewModel.Date, user); } }