public async Task <IActionResult> Details(int?id) { if (id == null) { return(BadRequest()); } var achievement = await achievementsRepository.FindAchievementByIdAsync(id.Value); if (achievement == null) { return(NotFound($"Achievement with id {id} not found")); } return(View(achievement)); }
public async Task CheckAndUpdateСalculatedAchievementForUser(string userId, int achievementId) { var achievement = await achievementsRepository.FindAchievementByIdAsync(achievementId); if (achievement != null && achievement.Parameter != null) { if (await achievementsCalculator.IsDone(achievementId, userId)) { await userAchievementsRepository.AddUserAchievementAsync(achievementId, userId); } } }