public void GetStageWithAllNestedEntities(ref Stage stage) { using (var endingRepo = new EndingRepository(_transaction, _logger)) using (var questionRepo = new QuestionRepository(_transaction, _logger)) { stage.Endings = endingRepo.GetEndingsByStage(stage.Id); stage.Questions = questionRepo.GetQuestionsByStage(stage.Id); } }
public void GetQuizWithAllNestedEntities(ref Quiz quiz) { using (var ruleRepo = new RuleRepository(_transaction, _logger)) quiz.Rules = ruleRepo.GetRulesByQuiz(quiz.Id); using (var questionRepo = new QuestionRepository(_transaction, _logger)) using (var endingRepo = new EndingRepository(_transaction, _logger)) using (var stageRepo = new StageRepository(_transaction, _logger)) { var stages = stageRepo.GetStagesByQuiz(quiz.Id); foreach (var stage in stages) { stage.Endings = endingRepo.GetEndingsByStage(stage.Id); stage.Questions = questionRepo.GetQuestionsByStage(stage.Id); } quiz.Stages = stages; } }