public void SaveResults(User currentUser, TestResult model) { var session = new TestSession { IsValid = model.ResultEmotion == model.SelectedEmotion, ResultType = EmotionUtil.GetEmotionType(model.ResultEmotion), Type = EmotionUtil.GetEmotionType(model.SelectedEmotion), StartDate = DateTime.Now, User = currentUser, TestLogs = new List <TestLog>(), Source = model.Source }; testRepository.Add(session); }
public void SaveResults(User currentUser, TrainingSetupModel model) { var session = new TrainingSession { StartDate = model.StartDate, User = currentUser, TrainingLogs = new List <TrainingLog>(), Status = TrainingSessionStatus.InProgress, EmotionType = EmotionUtil.GetEmotionType(model.SelectedEmotion) }; var sources = model.Sources.Select(x => new TrainingSource { SourceUrl = x, TrainingSession = session }); session.TrainingSources = sources.ToList(); trainingRepository.Add(session); // HERE WE SHOULD START LOGGING PROCESS hostedService.StartAsync(new CancellationToken(false)); }