Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Controller
- [ValidateAntiForgeryToken]
- [HttpPost]
- public ActionResult Filter(FormCollection collection)
- {
- SearchFilterModel filter = new SearchFilterModel();
- TryUpdateModel(filter, collection);
- Request["BodyTypes"].ToArray();
- Session["filter"] = filter;
- return RedirectToAction("List", new { page = 1 });
- }
- //view
- @using (Html.BeginForm("Filter", "Search"))
- {
- @Html.AntiForgeryToken()
- <span>Idade ente @Html.TextBox("AgeMin", String.Empty, new { style = "width: 20px;", maxlength = "2" })
- e @Html.TextBox("AgeMax", String.Empty, new { style = "width: 20px;", maxlength = "2" })</span><br />
- <span>Tipo fisico: @Html.CheckBox("BodyTypes", new { value = "41" })Magro</span>
- <span>@Html.CheckBox("BodyTypes", new { value = "42" })Atlético</span>
- <span>@Html.CheckBox("BodyTypes", new { value = "43" })Na média</span>
- <span>@Html.CheckBox("BodyTypes", new { value = "44" })Um pouco acima do peso</span>
- <br />
- <span>Estado civil: @Html.CheckBox("Relationships", new { value = "1" })Solteiro</span>
- <span>@Html.CheckBox("Relationships", new { value = "2" })Separado</span>
- <span>@Html.CheckBox("Relationships", new { value = "3" })Divorciado</span>
- <span>@Html.CheckBox("Relationships", new { value = "4" })Viúvo</span>
- <span>@Html.CheckBox("Relationships", new { value = "5" })Digo depois</span><br />
- <span>@Html.SubmitButton("Pesquisar", "Pesquisar")</span>
- }
- //Objeto
- public List<int> Relationships { get; set; }
- public List<int> BodyTypes { get; set; }
Add Comment
Please, Sign In to add comment