public ActionResult Create(QAModel model) { AnswerWS Aws = new AnswerWS(); if (model.answer.QuestionId == 0) { model.answer.QuestionId = model.question.QuestionId; } TempData["StatusMsg"] = Aws.WriteAnswer(model.answer, 1, this); return(RedirectToActionPermanent("Details", "Questions", new { QuestionId = model.answer.QuestionId })); //ModelState.AddModelError("", "An error occured while adding the answer"); //return View(model); }
public ActionResult Update(QAModel model) { try { Answer answer = model.answer; AnswerWS Aws = new AnswerWS(); DBUtil objDBUtil = new DBUtil(3); TempData["StatusMsg"] = Aws.WriteAnswer(answer, 2, this); if (TempData["UrlReferrer"] != null) { return(RedirectPermanent(TempData["UrlReferrer"].ToString())); } return(RedirectToActionPermanent("Details", "Questions", new { QuestionId = model.question.QuestionId })); } catch { } ModelState.AddModelError("", "An error occured while updating the answer"); return(RedirectPermanent(this.GetRequestReferrer())); }