I have something like this:
public ActionResult Create(int clubid)
{
var club = db.Clubs.Single(c=>c.Id == clubid);
ViewBag.Club = club;
Competition comp = db.Competitions.Create();
return View(comp)
}
and in my .cshtml:
@Model Models.Competition
...
@Using(Html.BeginForm())
{
...
<input type="submit" value="Save" />
}
This works fine with the following Post Action:
[HttpPost]
public ActionResult Create(Competition comp)
{
if (ModelState.IsValid){...}
return RedirectToAction(...);
}
However, I want to pass an additional parameter from the @ViewBag.Club
object:
[HttpPoSt]
public ActionResult Create(int clubid, Competition comp){...}
How do I code this in the BeginForm
?