You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.4KB

  1. @model CartWise.Web.ViewModels.Product.ProductSearchViewModel
  2. @{
  3. ViewData["Title"] = "Search products";
  4. }
  5. <h1>Search products</h1>
  6. <form asp-controller="Product" asp-action="Search" method="get" class="row g-2 mb-4">
  7. <div class="col-9 col-sm-8">
  8. <label for="q" class="visually-hidden">Search</label>
  9. <input type="text" id="q" name="q" class="form-control" placeholder="Search products" value="@Model.Query" />
  10. </div>
  11. <div class="col-3 col-sm-2">
  12. <button type="submit" class="btn btn-primary w-100">Search</button>
  13. </div>
  14. </form>
  15. @if (!string.IsNullOrWhiteSpace(Model.Query) && Model.Results.Count == 0)
  16. {
  17. <p class="text-muted">No products matched "@Model.Query".</p>
  18. }
  19. else if (Model.Results.Count > 0)
  20. {
  21. <ul class="list-group">
  22. @foreach (var result in Model.Results)
  23. {
  24. <li class="list-group-item">
  25. <a asp-controller="Product" asp-action="Details" asp-route-id="@result.ProductId">@result.Name</a>
  26. @if (!string.IsNullOrEmpty(result.BrandName))
  27. {
  28. <span class="text-muted"> — @result.BrandName</span>
  29. }
  30. @if (!string.IsNullOrEmpty(result.PackageDisplay))
  31. {
  32. <span class="text-muted"> (@result.PackageDisplay)</span>
  33. }
  34. </li>
  35. }
  36. </ul>
  37. }

Powered by TurnKey Linux.