public async Task <IActionResult> AnsToQuestion(KB_QA answer)
        {
            if (ModelState.IsValid)
            {
                await _db.UpdateQA(answer);

                return(RedirectToAction("ReadAllQAs", "EditQAs"));
            }
            return(View(answer));
        }
        public async Task <IActionResult> EditOneQA(KB_QA nqa)
        {
            if (ModelState.IsValid)
            {
                await _db.UpdateQA(nqa);

                return(RedirectToAction("ReadAllQAs", "EditQAs"));
            }
            return(View(nqa));
        }
Exemple #3
0
        public async Task <IActionResult> AskQuestion(KB_QA question)
        {
            if (ModelState.IsValid)
            {
                // если форма заполнениа правильно
                // добавить вопрос в коллекцию вопросов
                await _db.CreateQA(question);

                return(RedirectToAction("Index", "QuestionAnswer"));
            }
            return(View(question));
        }
Exemple #4
0
 public async Task UpdateQA(KB_QA nqa)
 {
     await QACollection.ReplaceOneAsync(new BsonDocument("_id", new ObjectId(nqa.Id)), nqa);
 }
Exemple #5
0
 public async Task CreateQA(KB_QA qa)
 {
     await QACollection.InsertOneAsync(qa);
 }