I am pretty new to MVC and I am trying to create an application from scratch.
My controller code -
// GET: /Jobs/Create
public ActionResult Create()
{
return View();
}
// POST: /Jobs/Create
[HttpPost]
[ValidateAntiForgeryToken]
//public ActionResult Create([Bind(Include="JobId,CategoryId,Title,Location,Duration,Skills,Description,DatePosted")] Job job)
public ActionResult Create(String title)
{
if (ModelState.IsValid)
{
//db.Jobs.Add(job);
//db.SaveChanges();
//return RedirectToAction("Index");
}
//return View(job);
return View();
}
and my view code -
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
@Html.ValidationSummary(true)
<div class="form-group">
@Html.LabelFor(model => model.Title, new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Title)
@Html.ValidationMessageFor(model => model.Title)
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</div>
</div>
}
when I click "Create" it goes to the create method without any parameters. How do I get it to go to the one with a 'title' parameter?