public async Task <IActionResult> Edit(int id, [Bind("Id,Question,Answer,CreationTime")] FaQ faQ) { if (id != faQ.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(faQ); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FaQExists(faQ.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(faQ)); }
public async Task <IActionResult> Create([Bind("Id,Question,Answer,CreationTime")] FaQ faQ) { if (ModelState.IsValid) { _context.Add(faQ); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(faQ)); }