Ejemplo n.º 1
0
 private async Task SaveAnswersWithResult(List <AnswerDbo> answersDbo, ResultDbo resultDbo)
 {
     foreach (var answerDbo in answersDbo)
     {
         answerDbo.Result = resultDbo;
         _context.Add(answerDbo);
     }
     await _context.SaveChangesAsync();
 }
Ejemplo n.º 2
0
        private async Task <ResultDbo> SaveResult(TestDbo test, UserDbo user, double score)
        {
            var result = new ResultDbo
            {
                User     = user,
                DateTime = DateTime.Now,
                Test     = test,
                Score    = score
            };

            _context.Add(result);
            await _context.SaveChangesAsync();

            return(result);
        }