// Constructors public QuizVM() { quiz = new Quiz(); }
public QuizVM(Quiz quiz) { this.quiz = quiz; CreateObservable(quiz); AddCommand = new RelayCommand(AddQuestion); }
public void CreateObservable(Quiz quiz) { IEnumerable<Question> selectedQuizQuestionResult = MainViewModel.context.Question.Where(vr => vr.QuizId == quiz.Id).ToList(); IEnumerable<QuestionVM> selectedQuizVragen = selectedQuizQuestionResult.Select(pk => new QuestionVM(pk)); QuestionList = new ObservableCollection<QuestionVM>(selectedQuizVragen); }