public async Task <IActionResult> Edit(int id, [Bind("Id,DateAdded,Question,Answer")] QnAPair qnAPair) { if (id != qnAPair.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(qnAPair); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!QnAPairExists(qnAPair.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(qnAPair)); }
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)); }
public async Task <IHttpActionResult> Post(QnAPair qnAPair) { await _kbService.UpdateAsync(qnAPair.question, qnAPair.answer); return(Ok()); }