Пример #1
0
        public async Task <IActionResult> Create([Bind("Id,DateAdded,Question,Answer")] QnAPair qnAPair)
        {
            if (ModelState.IsValid)
            {
                _context.Add(qnAPair);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(qnAPair));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("Id,ServiceId,BaseAddress,Key,DisplayName,DisplayCategory")] QnAMakerService qnAMakerService)
        {
            if (ModelState.IsValid)
            {
                _context.Add(qnAMakerService);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(qnAMakerService));
        }
 /// <summary>
 /// Saves questions to the database that could not be answered
 /// </summary>
 /// <param name="question"></param>
 /// <returns></returns>
 public async Task SaveUnansweredQuestion(string question)
 {
     db.QnAPair.Add(new QnAPair(question));
     await db.SaveChangesAsync();
 }