Advertisement
Guest User

zaefaefzgq

a guest
Dec 12th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. @{
  2. ViewBag.Title = "Rechercher";
  3. }
  4.  
  5. <h2>Rechercher</h2>
  6. <div>
  7. @using (Html.BeginForm("Rechercher", "Rechercher", FormMethod.Get))
  8. {
  9. <p>Nom de la pioche recherchée ?</p>
  10. @Html.TextBox("nomRecherche")
  11. <input type="submit" value="Rechercher" />
  12. }
  13. </div>
  14. @if (ViewBag.Error == "0")
  15. {
  16. List<Pioche> lp = Model;
  17. <br />
  18. <br />
  19. foreach (Pioche p in lp)
  20. {
  21. <div class="card" style="width: 18rem;">
  22. <div class="card-body">
  23. <h5 class="card-title">@Html.DisplayFor(_ => p.Nom)</h5>
  24. <p class="card-text">@Html.DisplayFor(_ => p.Description)</p>
  25. </div>
  26. <ul class="list-group list-group-flush">
  27. <li class="list-group-item">Prix : @Html.DisplayFor(_ => p.Prix)</li>
  28. <li class="list-group-item">Rarete : @Html.DisplayFor(_ => p.Rarete)</li>
  29. <li class="list-group-item">Pouvoir : @Html.DisplayFor(_ => p.Pouvoir)</li>
  30. <li class="list-group-item">Type : @Html.DisplayFor(_ => p.Type)</li>
  31. <li class="list-group-item">Date : @Html.DisplayFor(_ => p.DateP)</li>
  32. </ul>
  33. </div>
  34. }
  35. }
  36. else
  37. {
  38. <br />
  39. <br /><p>Il n'existe pas de pioche qui porte ce nom.</p>
  40. }
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49. using System;
  50. using System.Collections.Generic;
  51. using System.Linq;
  52. using System.Web;
  53. using System.Web.Mvc;
  54.  
  55. namespace FortniteWebManager.Controllers
  56. {
  57. public class RechercherController : Controller
  58. {
  59. // GET: Rechercher
  60. public ActionResult Index()
  61. {
  62. return View();
  63. }
  64.  
  65. public ActionResult Rechercher()
  66. {
  67. ManagerFBR m = ManagerFBR.Instance;
  68. List<Pioche> lt = new List<Pioche>();
  69. ViewBag.Error = "0";
  70. string nom = Request.QueryString["nomRecherche"];
  71. if(nom != null && nom != "")
  72. {
  73. lt = m.LesPioches.GetPiocheByName(nom);
  74. if(lt.Count == 0)
  75. {
  76. ViewBag.Error = "1";
  77. }
  78. }
  79. return View("Rechercher", lt);
  80. }
  81. }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement