Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @{
- ViewBag.Title = "Rechercher";
- }
- <h2>Rechercher</h2>
- <div>
- @using (Html.BeginForm("Rechercher", "Rechercher", FormMethod.Get))
- {
- <p>Nom de la pioche recherchée ?</p>
- @Html.TextBox("nomRecherche")
- <input type="submit" value="Rechercher" />
- }
- </div>
- @if (ViewBag.Error == "0")
- {
- List<Pioche> lp = Model;
- <br />
- <br />
- foreach (Pioche p in lp)
- {
- <div class="card" style="width: 18rem;">
- <div class="card-body">
- <h5 class="card-title">@Html.DisplayFor(_ => p.Nom)</h5>
- <p class="card-text">@Html.DisplayFor(_ => p.Description)</p>
- </div>
- <ul class="list-group list-group-flush">
- <li class="list-group-item">Prix : @Html.DisplayFor(_ => p.Prix)</li>
- <li class="list-group-item">Rarete : @Html.DisplayFor(_ => p.Rarete)</li>
- <li class="list-group-item">Pouvoir : @Html.DisplayFor(_ => p.Pouvoir)</li>
- <li class="list-group-item">Type : @Html.DisplayFor(_ => p.Type)</li>
- <li class="list-group-item">Date : @Html.DisplayFor(_ => p.DateP)</li>
- </ul>
- </div>
- }
- }
- else
- {
- <br />
- <br /><p>Il n'existe pas de pioche qui porte ce nom.</p>
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- namespace FortniteWebManager.Controllers
- {
- public class RechercherController : Controller
- {
- // GET: Rechercher
- public ActionResult Index()
- {
- return View();
- }
- public ActionResult Rechercher()
- {
- ManagerFBR m = ManagerFBR.Instance;
- List<Pioche> lt = new List<Pioche>();
- ViewBag.Error = "0";
- string nom = Request.QueryString["nomRecherche"];
- if(nom != null && nom != "")
- {
- lt = m.LesPioches.GetPiocheByName(nom);
- if(lt.Count == 0)
- {
- ViewBag.Error = "1";
- }
- }
- return View("Rechercher", lt);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement