public async Task <IActionResult> Create([Bind("ID,Category,Content,CorrectAnswer")] Question question)
        {
            if (ModelState.IsValid)
            {
                _context.Add(question);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(question));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("Content", "CorrectAnswer")] Hint hint, int qid)
        {
            if (ModelState.IsValid)
            {
                hint.QuestionID = qid;
                _context.Add(hint);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index", new { questionid = qid }));
            }
            return(View(hint));
        }