public ActionResult Revert(int answerid, String answer, int correct, String weight, string ansnum)
{
if (Session["uid"] == null || Session["uid"].ToString().Equals(""))
{
return RedirectToAction("Index", "Home");
}
if ((int)Session["user_type"] < User_Type.POLL_MASTER)
{
return RedirectToAction("Invalid", "Home");
}
answerModel a = new answerModel();
a = a.getAnswer(answerid);
/* Create a record of the old answer in the Answer History table */
new answerHistoryModel(answerid).createAnswerHistory(a.answerid, a.answer, a.correct, a.weight, a.ansnum);
/* Update the answer*/
a.updateAnswer(answerid, answer, correct, int.Parse(weight), int.Parse(ansnum));
a = a.getAnswer(answerid);
return RedirectToAction("Index", "answerHistory", new { id = a.answerid, name = a.answer } );
}