public void Save(ml_ForumAnswer answer) { if (answer.ID <= 0) { _repo.Insert(answer); } else { _repo.Update(answer); } }
public ActionResult Thread(ml_ForumAnswer model) { if (ModelState.IsValid) { model.ID = -1; model.UserID = CurrentUser.ID; _answerService.Save(model); // redirect to Thread action in order to reload thread and all it's answers. return RedirectToAction("Thread", new { id = model.ThreadID }); } return View("Thread", _threadService.GetThread(model.ThreadID)); }