I try to call method that returns View
inside of another method, but in the same controller. There is my code:
public ActionResult GetAnswer(List<PossibleAnswerVM> possibleAnswers)
{
if (IsLastQuestion(possibleAnswers.FirstOrDefault().IdQuestion))
{
return Index();
}
return null;
}
[HttpGet]
public ActionResult Index()
{
IEnumerable<Anketa> anketas = Manager.SelectAnketa();
return View(anketas);
}
And there is the form which call GetAnswer()
@using (Ajax.BeginForm("GetAnswer", "Survey", FormMethod.Post,
new AjaxOptions { InsertionMode = InsertionMode.Replace }))
{
<input type="submit" value="Ответить"
onclick="answerClick(@Model.FirstOrDefault().OrdQuestion);"
class="btn btn-default" />
}
Also I have tried RedirectToAction()
and call methods from another controller.
I would appreciate any help.