private async Task SaveAnswersWithResult(List <AnswerDbo> answersDbo, ResultDbo resultDbo) { foreach (var answerDbo in answersDbo) { answerDbo.Result = resultDbo; _context.Add(answerDbo); } await _context.SaveChangesAsync(); }
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); }