Skip to content

Commit 949f041

Browse files
committed
refactoring application
1 parent 0af918d commit 949f041

File tree

14 files changed

+272
-190
lines changed

14 files changed

+272
-190
lines changed

AspNetRunBasicRealWorld/Areas/Identity/Pages/Account/Login.cshtml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66
}
77

88
<div class="container">
9-
<h1>@ViewData["Title"]</h1>
9+
<h1 class="mt-4 mb-3">
10+
@ViewData["Title"]
11+
</h1>
12+
<hr />
1013
</div>
11-
1214

13-
<div class="container">
15+
<div class="container">
1416
<div class="row">
1517
<div class="col-md-4">
1618
<section>

AspNetRunBasicRealWorld/Areas/Identity/Pages/Account/Register.cshtml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@
55
}
66

77
<div class="container">
8-
<h1>@ViewData["Title"]</h1>
8+
<h1 class="mt-4 mb-3">
9+
@ViewData["Title"]
10+
</h1>
11+
<hr />
912
</div>
10-
1113

1214
<div class="container">
15+
<h1 class="my-4"></h1>
1316
<div class="row">
1417
<div class="col-md-4">
1518
<form asp-route-returnUrl="@Model.ReturnUrl" method="post">

AspNetRunBasicRealWorld/AspNetRunBasicRealWorld.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.0">
1616
<PrivateAssets>all</PrivateAssets>
1717
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
18-
</PackageReference>
18+
</PackageReference>
19+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.0" />
1920
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.0" />
2021
</ItemGroup>
2122

AspNetRunBasicRealWorld/Pages/Category/Index.cshtml renamed to AspNetRunBasicRealWorld/Pages/Category.cshtml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@page
2-
@model AspNetRunBasicRealWorld.Pages.Category.IndexModel
2+
@model AspNetRunBasicRealWorld.CategoryModel
33
@{
44
ViewData["Title"] = "Categories";
55
}
@@ -23,8 +23,8 @@
2323
</div>
2424
</div>
2525
}
26-
</div>
27-
<hr class="mb-5">
26+
</div>
27+
<hr />
2828
<div class="row">
2929
<div class="col-md-4">
3030
<partial name="_MobileWidgetPartial" model="@("Download Today")" />
@@ -33,11 +33,8 @@
3333
<vc:popular-products count="2" />
3434
</div>
3535
<div class="col-md-4">
36-
<partial name="_ContactUsPartial" />
36+
<partial name="_ContactUsPartial" />
3737
</div>
3838
</div>
3939
<hr class="mb-5">
40-
</div>
41-
42-
43-
40+
</div>
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Linq;
43
using System.Threading.Tasks;
54
using AspNetRunBasicRealWorld.Repositories;
65
using Microsoft.AspNetCore.Mvc;
76
using Microsoft.AspNetCore.Mvc.RazorPages;
87

9-
namespace AspNetRunBasicRealWorld.Pages.Category
8+
namespace AspNetRunBasicRealWorld
109
{
11-
public class IndexModel : PageModel
10+
public class CategoryModel : PageModel
1211
{
1312
private readonly IProductRepository _productRepository;
1413

15-
public IndexModel(IProductRepository productRepository)
14+
public CategoryModel(IProductRepository productRepository)
1615
{
1716
_productRepository = productRepository ?? throw new ArgumentNullException(nameof(productRepository));
1817
}
@@ -24,5 +23,6 @@ public async Task<IActionResult> OnGetAsync()
2423
CategoryList = await _productRepository.GetCategories();
2524
return Page();
2625
}
26+
2727
}
2828
}

AspNetRunBasicRealWorld/Pages/Contact.cshtml

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -4,67 +4,67 @@
44
ViewData["Title"] = "Contact Us";
55
}
66

7-
<div class="container">
8-
<h1 class="mt-4 mb-3">
9-
Contact Us
10-
</h1>
11-
<hr />
12-
@if (!string.IsNullOrEmpty(Model.Message))
13-
{
14-
<div class="alert alert-success">@Model.Message</div>
15-
}
16-
<div class="row">
17-
<div class="col-md-8 mb-4">
18-
<br />
19-
<form asp-page="Contact" method="post" name="sentMessage" id="contactForm">
20-
<div class="control-group form-group">
21-
<div class="controls">
22-
<label asp-for="Contact.Name">Name:</label>
23-
<input asp-for="Contact.Name" class="form-control">
24-
<span asp-validation-for="Contact.Name" class="alert-danger"></span>
25-
</div>
26-
</div>
27-
<div class="control-group form-group">
28-
<div class="controls">
29-
<label asp-for="Contact.Phone">Phone:</label>
30-
<input asp-for="Contact.Phone" class="form-control">
31-
<span asp-validation-for="Contact.Phone" class="alert-danger"></span>
32-
</div>
33-
</div>
34-
<div class="control-group form-group">
35-
<div class="controls">
36-
<label asp-for="Contact.Email">Email:</label>
37-
<input asp-for="Contact.Email" class="form-control">
38-
<span asp-validation-for="Contact.Email" class="alert-danger"></span>
7+
<div class="container">
8+
<h1 class="mt-4 mb-3">
9+
Contact Us
10+
</h1>
11+
<hr />
12+
@if (!string.IsNullOrEmpty(Model.Message))
13+
{
14+
<div class="alert alert-success">@Model.Message</div>
15+
}
16+
<div class="row">
17+
<div class="col-md-8 mb-4">
18+
<br />
19+
<form asp-page="Contact" method="post" name="sentMessage" id="contactForm">
20+
<div class="control-group form-group">
21+
<div class="controls">
22+
<label asp-for="Contact.Name">Name:</label>
23+
<input asp-for="Contact.Name" class="form-control">
24+
<span asp-validation-for="Contact.Name" class="alert-danger"></span>
25+
</div>
3926
</div>
40-
</div>
41-
<div class="control-group form-group">
42-
<div class="controls">
43-
<label asp-for="Contact.Message">Message:</label>
44-
<textarea asp-for="Contact.Message" rows="10" cols="100" class="form-control"></textarea>
45-
<span asp-validation-for="Contact.Message" class="alert-danger"></span>
27+
<div class="control-group form-group">
28+
<div class="controls">
29+
<label asp-for="Contact.Phone">Phone:</label>
30+
<input asp-for="Contact.Phone" class="form-control">
31+
<span asp-validation-for="Contact.Phone" class="alert-danger"></span>
32+
</div>
4633
</div>
47-
</div>
48-
<div id="success"></div>
49-
<button type="submit" class="btn btn-success" id="sendMessageButton">Send Message!</button>
50-
</form>
51-
</div>
52-
<div class="col-md-4">
53-
<div>
54-
<h3>Keep in Touch</h3>
55-
<p>Sign up for our mailing list - no spam, we promise.</p>
56-
<form asp-page-handler="Subscribe">
5734
<div class="control-group form-group">
58-
<input name="address" type="text" class="form-control" placeholder="Email" />
35+
<div class="controls">
36+
<label asp-for="Contact.Email">Email:</label>
37+
<input asp-for="Contact.Email" class="form-control">
38+
<span asp-validation-for="Contact.Email" class="alert-danger"></span>
39+
</div>
5940
</div>
6041
<div class="control-group form-group">
61-
<input type="submit" class="btn btn-success" value="Join" />
42+
<div class="controls">
43+
<label asp-for="Contact.Message">Message:</label>
44+
<textarea asp-for="Contact.Message" rows="10" cols="100" class="form-control"></textarea>
45+
<span asp-validation-for="Contact.Message" class="alert-danger"></span>
46+
</div>
6247
</div>
48+
<div id="success"></div>
49+
<button type="submit" class="btn btn-success" id="sendMessageButton">Send Message!</button>
6350
</form>
6451
</div>
65-
<hr />
66-
<partial name="_MobileWidgetPartial" model="@("Get the app!")" />
67-
<h1 />
52+
<div class="col-md-4">
53+
<div>
54+
<h3>Keep in Touch</h3>
55+
<p>Sign up for our mailing list - no spam, we promise.</p>
56+
<form asp-page-handler="Subscribe">
57+
<div class="control-group form-group">
58+
<input name="address" type="text" class="form-control" placeholder="Email" />
59+
</div>
60+
<div class="control-group form-group">
61+
<input type="submit" class="btn btn-success" value="Join" />
62+
</div>
63+
</form>
64+
</div>
65+
<hr />
66+
<partial name="_MobileWidgetPartial" model="@("Get the app!")" />
67+
<h1 />
68+
</div>
6869
</div>
69-
</div>
70-
</div>
70+
</div>

AspNetRunBasicRealWorld/Pages/Index.cshtml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@
5656
{
5757
<div class="col-lg-4 col-sm-6 portfolio-item">
5858
<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>
59+
<a asp-page="Product" asp-route-productId="@product.Id"><img asp-append-version="true" class="card-img-top" src="~/images/product/@product.ImageFile" alt=""></a>
6060
<div class="card-body">
6161
<h4 class="card-title">
62-
<a asp-page="./Details" asp-route-productId="@product.Id" class="color-main">@product.Name</a>
62+
<a asp-page="Product" asp-route-productId="@product.Id" class="color-main">@product.Name</a>
6363
</h4>
6464
<p class="card-text">@product.Summary</p>
6565
</div>
6666
<div class="card-footer">
67-
<a asp-page="./Details" asp-route-productId="@product.Id" class="btn btn-success w-100">Go Details</a>
67+
<a asp-page="Product" asp-route-productId="@product.Id" class="btn btn-success w-100">Add to Cart</a>
6868
</div>
6969
</div>
7070
</div>

0 commit comments

Comments
 (0)