public QuestionVM(Question q)
 {
     this.question = q;
     CreateObserverbale(q);
     AddAnswerCommand = new RelayCommand(AddAnswer);
     DeleteAnswerCommand = new RelayCommand(DeleteAnswer);
 }
 public void CreateObserverbale(Question q)
 {
     IEnumerable<Answer> result = MainViewModel.context.Answer.Where(vr => vr.QuestionId == q.Id).ToList();
     IEnumerable<AnswerVM> selectedAnswers = result.Select(pk => new AnswerVM(pk));
     AnswerList = new ObservableCollection<AnswerVM>(selectedAnswers);
 }
 // Constructors
 public QuestionVM()
 {
     question = new Question();
 }
        public void AddQuestion()
        {
            if (QuestionText != null && QuestionList.Count < 10) {
                if (QuestionText.Trim().Length > 0) {
                    Question question = new Question();

                    question.QuizId = Id;
                    question.Text = QuestionText;
                    question.Category = "Overig";
                    question = MainViewModel.context.Question.Add(question);

                    MainViewModel.context.SaveChanges();
                    QuestionList.Add(new QuestionVM(question));
                    RaisePropertyChanged("QuestionList");
                    RaisePropertyChanged("HasPlace");
                }
            }
        }