Example #1
0
        public async Task <ActionResult <Question> > PostQuestion(Question question)
        {
            _IQuestion.Add(question);
            await _IQuestion.SaveAsync();

            return(CreatedAtAction("GetQuestion", new { id = question.QuestionId }, question));
        }
 public IActionResult Create(Question model)
 {
     if (ModelState.IsValid)
     {
         _Question.Add(model);
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
Example #3
0
        public int SeedQuestion(int recs, AnswerGroup _answerGroup)
        {
            // default: create 5 questions for a group ... = 5*5 for each survey
            for (int i = 1; i <= recs; i++)
            {
                var row = new Question
                {
                    QGroup       = 1, //default
                    Order        = i,
                    QuestionText = "Question " + Convert.ToString(i),
                    AnswerGroup  = _answerGroup
                };

                _question.Add(row);

                int result = SeedSurveyQuestion(10, row); //rc. 10 surveys * 25 questions each
            }

            //verify result
            int count = _question.GetAll().Count();

            return(count);
        }
Example #4
0
 public static bool Add(QuestionInfo info)
 {
     return(dal.Add(info));
 }