예제 #1
0
        public async Task <bool> SaveAttempt(Guid userId, TestAttempt attempt)
        {
            var allAttempts = await _tempAttemptRepository.GetAllAsync();

            var at = allAttempts.First(x => x.Id == attempt.Id);

            if (at.UserId != userId)
            {
                return(false);
            }

            at.TestState = attempt.TestState;

            at.TestGrade = attempt.TestGrade;

            at.TestId = attempt.TestId;

            await _tempAttemptRepository.UpdateAsync(at);

            return(true);
        }
 public async Task <bool> UpdateAsync(TestAttempt testAttempt)
 {
     return(await _testAttemptRepository.UpdateAsync(testAttempt));
 }