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)); }
public async Task <IActionResult> AskQuestion(KB_QA question) { if (ModelState.IsValid) { // если форма заполнениа правильно // добавить вопрос в коллекцию вопросов await _db.CreateQA(question); return(RedirectToAction("Index", "QuestionAnswer")); } return(View(question)); }
public async Task UpdateQA(KB_QA nqa) { await QACollection.ReplaceOneAsync(new BsonDocument("_id", new ObjectId(nqa.Id)), nqa); }
public async Task CreateQA(KB_QA qa) { await QACollection.InsertOneAsync(qa); }