Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0af918d

Browse files
modify index
1 parent 0e639fb commit 0af918d

File tree

4 files changed

+69
-6
lines changed

4 files changed

+69
-6
lines changed

‎AspNetRunBasicRealWorld/Pages/Index.cshtml

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,67 @@
3737

3838
<div class="container">
3939
<h1 class="my-4"></h1>
40+
41+
<form method="get">
42+
<div class="form-group">
43+
<div class="input-group">
44+
<input type="search" class="form-control" asp-for="SearchTerm" />
45+
<span class="input-group-btn">
46+
<button class="btn btn-success">
47+
Search
48+
</button>
49+
</span>
50+
</div>
51+
</div>
52+
</form>
53+
54+
<div class="row">
55+
@foreach (var product in Model.ProductList)
56+
{
57+
<div class="col-lg-4 col-sm-6 portfolio-item">
58+
<div class="card h-100">
59+
<a asp-page="./Details" asp-route-productId="@product.Id"><img asp-append-version="true" class="card-img-top" src="~/images/product/@product.ImageFile" alt=""></a>
60+
<div class="card-body">
61+
<h4 class="card-title">
62+
<a asp-page="./Details" asp-route-productId="@product.Id" class="color-main">@product.Name</a>
63+
</h4>
64+
<p class="card-text">@product.Summary</p>
65+
</div>
66+
<div class="card-footer">
67+
<a asp-page="./Details" asp-route-productId="@product.Id" class="btn btn-success w-100">Go Details</a>
68+
</div>
69+
</div>
70+
</div>
71+
}
72+
</div>
73+
<ul class="pagination justify-content-center">
74+
<li class="page-item">
75+
<a class="page-link" href="#" aria-label="Previous">
76+
<span aria-hidden="true">&laquo;</span>
77+
<span class="sr-only">Previous</span>
78+
</a>
79+
</li>
80+
<li class="page-item">
81+
<a class="page-link" href="#">1</a>
82+
</li>
83+
<li class="page-item">
84+
<a class="page-link" href="#">2</a>
85+
</li>
86+
<li class="page-item">
87+
<a class="page-link" href="#">3</a>
88+
</li>
89+
<li class="page-item">
90+
<a class="page-link" href="#" aria-label="Next">
91+
<span aria-hidden="true">&raquo;</span>
92+
<span class="sr-only">Next</span>
93+
</a>
94+
</li>
95+
</ul>
96+
</div>
97+
98+
99+
@*<div class="container">
100+
<h1 class="my-4"></h1>
40101
<div class="row">
41102
@foreach (var category in Model.CategoryList)
42103
{
@@ -68,4 +129,4 @@
68129
</div>
69130
</div>
70131
<hr class="mb-5">
71-
</div>
132+
</div>*@

‎AspNetRunBasicRealWorld/Pages/Index.cshtml.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ public IndexModel(IProductRepository productRepository)
1616
_productRepository = productRepository ?? throw new ArgumentNullException(nameof(productRepository));
1717
}
1818

19-
public IEnumerable<Entities.Category> CategoryList { get; set; } = new List<Entities.Category>();
19+
[BindProperty(SupportsGet = true)]
20+
public string SearchTerm { get; set; }
21+
public IEnumerable<Entities.Product> ProductList { get; set; } = new List<Entities.Product>();
2022

2123
public async Task<IActionResult> OnGetAsync()
2224
{
23-
CategoryList = await _productRepository.GetCategories();
25+
ProductList = await _productRepository.GetProductByNameAsync(SearchTerm);
2426
return Page();
2527
}
2628
}

‎AspNetRunBasicRealWorld/Pages/Product/Index.cshtml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace AspNetRunBasicRealWorld.Pages.Product
1010
{
11-
[Authorize]
11+
//[Authorize]
1212
public class IndexModel : PageModel
1313
{
1414
private readonly IProductRepository _productRepository;

‎AspNetRunBasicRealWorld/Pages/Shared/_Layout.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@
5050
<div class="container">
5151
<div class="row">
5252
<div class="col-md-4">
53-
<p class="m-0 text-white">Copyright &copy; AspnetRun Electronics</p>
53+
<p class="m-0 text-white">Copyright &copy; AspnetRun</p>
5454
</div>
5555
<div class="col-md-4">
5656
<p class="m-0 text-white">Contact Info:</p>
57-
<p class="m-0 text-white">Phone: 501-222-2222 <br />Address: Gungoren Esenler <br />Email: aspnetrun@outlook.com</p>
57+
<p class="m-0 text-white">Phone: 501-222-2222 <br />Address: Bahcelievler Istanbul <br />Email: aspnetrun@outlook.com</p>
5858
</div>
5959
<div class="col-md-4">
6060
@if (IsSectionDefined("FooterCustomize"))

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /