public ActionResult AddQuestion(Question question) { if (ModelState.IsValid) { _questionDbContext.dbSet.Add(question); _questionDbContext.SaveChanges(); return RedirectToAction("AddQuestion"); } return View(question); }
public ActionResult Edit(Question question) { if (ModelState.IsValid) { _questionDbContext.Entry(question).State = EntityState.Modified; _questionDbContext.SaveChanges(); return RedirectToAction("Index"); } return View(question); }