Guest User

Untitled

a guest
Apr 24th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. //Controller
  2. [ValidateAntiForgeryToken]
  3. [HttpPost]
  4. public ActionResult Filter(FormCollection collection)
  5. {
  6.  
  7. SearchFilterModel filter = new SearchFilterModel();
  8. TryUpdateModel(filter, collection);
  9. Request["BodyTypes"].ToArray();
  10. Session["filter"] = filter;
  11. return RedirectToAction("List", new { page = 1 });
  12.  
  13. }
  14.  
  15. //view
  16. @using (Html.BeginForm("Filter", "Search"))
  17. {
  18. @Html.AntiForgeryToken()
  19.  
  20. <span>Idade ente @Html.TextBox("AgeMin", String.Empty, new { style = "width: 20px;", maxlength = "2" })
  21. e @Html.TextBox("AgeMax", String.Empty, new { style = "width: 20px;", maxlength = "2" })</span><br />
  22.  
  23. <span>Tipo fisico: @Html.CheckBox("BodyTypes", new { value = "41" })Magro</span>
  24. <span>@Html.CheckBox("BodyTypes", new { value = "42" })Atlético</span>
  25. <span>@Html.CheckBox("BodyTypes", new { value = "43" })Na média</span>
  26. <span>@Html.CheckBox("BodyTypes", new { value = "44" })Um pouco acima do peso</span>
  27. <br />
  28.  
  29. <span>Estado civil: @Html.CheckBox("Relationships", new { value = "1" })Solteiro</span>
  30. <span>@Html.CheckBox("Relationships", new { value = "2" })Separado</span>
  31. <span>@Html.CheckBox("Relationships", new { value = "3" })Divorciado</span>
  32. <span>@Html.CheckBox("Relationships", new { value = "4" })Viúvo</span>
  33. <span>@Html.CheckBox("Relationships", new { value = "5" })Digo depois</span><br />
  34.  
  35. <span>@Html.SubmitButton("Pesquisar", "Pesquisar")</span>
  36. }
  37.  
  38. //Objeto
  39.  
  40. public List<int> Relationships { get; set; }
  41. public List<int> BodyTypes { get; set; }
Add Comment
Please, Sign In to add comment