public ActionResult Create(Answer model) { if(ModelState.IsValid) { AnswerRepository.Insert(model); AnswerRepository.Save(); } FillDropdownValues(); return View(model); }
public ActionResult EditPost(Answer formModel) { if (ModelState.IsValid) { var modelDb = AnswerRepository.Find(formModel.ID); if(this.TryUpdateModel(modelDb)) { AnswerRepository.Update(modelDb); AnswerRepository.Save(); return RedirectToAction("Index"); } } FillDropdownValues(); return View(formModel); }