Exemple #1
0
        // view skill practice history
        public async Task <IActionResult> History(int id)
        {
            var currentUser = await _userManager.GetUserAsync(User);

            if (currentUser == null)
            {
                return(Challenge());
            }

            var skill = _skillRepository.GetSkillById(id);

            var practices = await _practiceRepository.GetPracticeBySkillIdAsync(id);

            var skillHistory = _db.Practices.Where(x => x.Skill.Id == id)
                               .Where(r => r.ApplicationUserId == currentUser.Id).ToList();

            ViewBag.Practices = skillHistory;

            return(View(new SkillHistoryViewModel(skillHistory)
            {
                Skill = skill
            }));
        }