private void btnSaveQuestion_Click(object sender, EventArgs e)
        {
            int    categorySelectedIndex = cmbCategory.SelectedIndex;
            string subjectNew;
            string contentNew;

            string urgency;

            if (cbUrgent.Checked == true)
            {
                urgency = "Urgent";
            }
            else
            {
                urgency = "Not Urgent";
            }

            subjectNew = (tbSubjectNew.Text == "") ? tbSubjectOld.Text : tbSubjectNew.Text;
            contentNew = (tbContentNew.Text == "") ? tbContentOld.Text : tbContentNew.Text;

            if (categorySelectedIndex == -1)
            {
                //                QuestionContextSQL.FormCareEditQuestion(questionID, subjectNew, contentNew, urgency);
            }
            else
            {
                Category category = categories[categorySelectedIndex];
                QuestionLogic.EditQuestion(_question.QuestionId, subjectNew, contentNew, category, urgency);

                MessageBox.Show("Hulpvraag bewerkt.");
                ((FormMain)this.Parent.Parent).ReplaceForm(new FormCareQuestionOverview());
            }
        }
Example #2
0
        public ActionResult Edit(int id, QuestionViewModel question)
        {
            try
            {
                _questionLogic.EditQuestion(new Question(id, question.Title, question.Content, Question.QuestionStatus.Open, question.Date, question.Urgency, new Category(question.CategoryId), question.CareRecipientId));

                return(RedirectToAction("Overview"));
            }
            catch
            {
                return(RedirectToAction("Edit"));
            }
        }
        public void EditQuestion_IsValid()
        {
            Mock <IQuestionContext> mockContext = new Mock <IQuestionContext>();
            Mock <Category>         category    = new Mock <Category>("Medisch");
            Mock <Question>         question    = new Mock <Question>(1, "foo", "baa", Question.QuestionStatus.Open, DateTime.Today, true, category.Object, 12);

            mockContext.Setup(x => x.EditQuestion(question.Object));

            QuestionLogic questionLogic = new QuestionLogic(mockContext.Object);

            questionLogic.EditQuestion(question.Object);

            mockContext.Verify(x => x.EditQuestion(question.Object), Times.Exactly(1));
        }