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.
|
- @model CartWise.Web.ViewModels.Product.ProductSearchViewModel
- @{
- ViewData["Title"] = "Search products";
- }
-
- <h1>Search products</h1>
-
- <form asp-controller="Product" asp-action="Search" method="get" class="row g-2 mb-4">
- <div class="col-9 col-sm-8">
- <label for="q" class="visually-hidden">Search</label>
- <input type="text" id="q" name="q" class="form-control" placeholder="Search products" value="@Model.Query" />
- </div>
- <div class="col-3 col-sm-2">
- <button type="submit" class="btn btn-primary w-100">Search</button>
- </div>
- </form>
-
- @if (!string.IsNullOrWhiteSpace(Model.Query) && Model.Results.Count == 0)
- {
- <p class="text-muted">No products matched "@Model.Query".</p>
- }
- else if (Model.Results.Count > 0)
- {
- <ul class="list-group">
- @foreach (var result in Model.Results)
- {
- <li class="list-group-item">
- <a asp-controller="Product" asp-action="Details" asp-route-id="@result.ProductId">@result.Name</a>
- @if (!string.IsNullOrEmpty(result.BrandName))
- {
- <span class="text-muted"> — @result.BrandName</span>
- }
- @if (!string.IsNullOrEmpty(result.PackageDisplay))
- {
- <span class="text-muted"> (@result.PackageDisplay)</span>
- }
- </li>
- }
- </ul>
- }
|