I want to call MarriageById as GET, like this:
var url = '/MarriageById?id=' + id; But I also want to have a single ActionResult Marriage(Marriage marriage) that does some processing before showing the view. This second one must be POST because it will also receive the "send form" from asp.
I am trying this solution (see my own implementation below), but it is still redirected as a GET and ActionResult Marriage is not found:
[HttpGet] public ActionResult MarriageById(int id) { var marriage = _marriageRepository.GetById(id); return RedirectToAction(nameof(Marriage), marriage); } [HttpPost] public ActionResult Marriage(Marriage marriage) { var people = _personRepository.GetAll(); ViewBag.men = Utils.GetPersonsSelectListByGender(people, isMale: true); ViewBag.women = Utils.GetPersonsSelectListByGender(people, isMale: false); return View(marriage); }