Skip to content
This repository was archived by the owner on May 23, 2024. It is now read-only.

Commit 3dac26b

Browse files
authored
Merge pull request #19 from michelcedric/main
.net 7 migration
2 parents 42465b2 + 051ed37 commit 3dac26b

File tree

15 files changed

+361
-349
lines changed

15 files changed

+361
-349
lines changed

eShopOnBlazor.sln

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,31 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.29123.89
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.4.33213.308
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "eShopLegacyWebForms", "src\eShopLegacyWebForms\eShopLegacyWebForms.csproj", "{4416714A-9BB8-480B-95B3-C2599598E3EC}"
7-
EndProject
86
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "eShopOnBlazor", "src\eShopOnBlazor\eShopOnBlazor.csproj", "{9AABB26C-7C3E-4308-8968-77706D2ED790}"
97
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solutions items", "Solutions items", "{E3005DB1-8CF6-4640-A016-02E3B12B5BAD}"
9+
ProjectSection(SolutionItems) = preProject
10+
README.md = README.md
11+
EndProjectSection
12+
EndProject
13+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "eShopLegacyWebForms", "src\eShopLegacyWebForms\eShopLegacyWebForms.csproj", "{4416714A-9BB8-480B-95B3-C2599598E3EC}"
14+
EndProject
1015
Global
1116
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1217
Debug|Any CPU = Debug|Any CPU
1318
Release|Any CPU = Release|Any CPU
1419
EndGlobalSection
1520
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16-
{4416714A-9BB8-480B-95B3-C2599598E3EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17-
{4416714A-9BB8-480B-95B3-C2599598E3EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
18-
{4416714A-9BB8-480B-95B3-C2599598E3EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
19-
{4416714A-9BB8-480B-95B3-C2599598E3EC}.Release|Any CPU.Build.0 = Release|Any CPU
2021
{9AABB26C-7C3E-4308-8968-77706D2ED790}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2122
{9AABB26C-7C3E-4308-8968-77706D2ED790}.Debug|Any CPU.Build.0 = Debug|Any CPU
2223
{9AABB26C-7C3E-4308-8968-77706D2ED790}.Release|Any CPU.ActiveCfg = Release|Any CPU
2324
{9AABB26C-7C3E-4308-8968-77706D2ED790}.Release|Any CPU.Build.0 = Release|Any CPU
25+
{4416714A-9BB8-480B-95B3-C2599598E3EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
26+
{4416714A-9BB8-480B-95B3-C2599598E3EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
27+
{4416714A-9BB8-480B-95B3-C2599598E3EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
28+
{4416714A-9BB8-480B-95B3-C2599598E3EC}.Release|Any CPU.Build.0 = Release|Any CPU
2429
EndGlobalSection
2530
GlobalSection(SolutionProperties) = preSolution
2631
HideSolutionNode = FALSE

src/eShopOnBlazor/Data/WeatherForecast.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/eShopOnBlazor/Data/WeatherForecastService.cs

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/eShopOnBlazor/Models/CatalogItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public CatalogItem()
1818
public string Description { get; set; }
1919

2020
// decimal(18,2)
21-
[RegularExpression(@"^\d+(\.\d{0,2})*$", ErrorMessage = "The field Price must be a positive number with maximum two decimals.")]
21+
[RegularExpression(@"^\d+.\d{0,2}$", ErrorMessage = "The field Price must be a positive number with maximum two decimals.")]
2222
[Range(0, 9999999999999999.99)]
2323
[DataType(DataType.Currency)]
2424
public decimal Price { get; set; }

src/eShopOnBlazor/Pages/Catalog/Create.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@
106106
@code {
107107
private readonly CatalogItem _item = new CatalogItem();
108108

109-
private IEnumerable<CatalogType> _types;
110-
private IEnumerable<CatalogBrand> _brands;
109+
private IEnumerable<CatalogType> _types = new List<CatalogType>();
110+
private IEnumerable<CatalogBrand> _brands = new List<CatalogBrand>();
111111

112112
protected override void OnInitialized()
113113
{

src/eShopOnBlazor/Pages/Catalog/Delete.razor

Lines changed: 104 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -5,106 +5,122 @@
55

66

77
<div class="container">
8-
<div class="row">
9-
<img class="col-md-6 esh-picture" src="@($"/Pics/{_item.PictureFileName}")">
10-
<dl class="col-md-6 dl-horizontal">
11-
<dt>
12-
Name
13-
</dt>
14-
15-
<dd>
16-
@_item.Name
17-
</dd>
18-
19-
<dt>
20-
Description
21-
</dt>
22-
23-
<dd>
24-
@_item.Description
25-
</dd>
26-
27-
<dt>
28-
Brand
29-
</dt>
30-
31-
<dd>
32-
@{
33-
string catalogBrandName = _item.CatalogBrand != null ? _item.CatalogBrand.Brand : String.Empty;
34-
}
35-
@catalogBrandName
36-
</dd>
37-
38-
<dt>
39-
Type
40-
</dt>
41-
42-
<dd>
43-
@{
44-
string catalogTypeName = _item.CatalogType != null ? _item.CatalogType.Type : String.Empty;
8+
@if (_item != null)
9+
{
10+
<div class="row">
11+
<img class="col-md-6 esh-picture" src="@($"/Pics/{_item.PictureFileName}")">
12+
<dl class="col-md-6 dl-horizontal">
13+
<dt>
14+
Name
15+
</dt>
16+
17+
<dd>
18+
@_item.Name
19+
</dd>
20+
21+
<dt>
22+
Description
23+
</dt>
24+
25+
<dd>
26+
@_item.Description
27+
</dd>
28+
29+
<dt>
30+
Brand
31+
</dt>
32+
33+
<dd>
34+
@{
35+
string catalogBrandName = _item.CatalogBrand != null ? _item.CatalogBrand.Brand : String.Empty;
36+
}
37+
@catalogBrandName
38+
</dd>
39+
40+
<dt>
41+
Type
42+
</dt>
43+
44+
<dd>
45+
@{
46+
string catalogTypeName = _item.CatalogType != null ? _item.CatalogType.Type : String.Empty;
47+
}
48+
@catalogTypeName
49+
</dd>
50+
<dt>
51+
Price
52+
</dt>
53+
54+
<dd>
55+
@_item.Price
56+
</dd>
57+
58+
<dt>
59+
Picture name
60+
</dt>
61+
62+
<dd>
63+
@_item.PictureFileName
64+
</dd>
65+
66+
<dt>
67+
Stock
68+
</dt>
69+
70+
<dd>
71+
@_item.AvailableStock
72+
</dd>
73+
74+
<dt>
75+
Restock
76+
</dt>
77+
78+
<dd>
79+
@_item.RestockThreshold
80+
</dd>
81+
82+
<dt>
83+
Max stock
84+
</dt>
85+
86+
<dd>
87+
@_item.MaxStockThreshold
88+
</dd>
89+
90+
<dt></dt>
4591
}
46-
@catalogTypeName
47-
</dd>
48-
<dt>
49-
Price
50-
</dt>
51-
52-
<dd>
53-
@_item.Price
54-
</dd>
92+
<dd class="text-right esh-button-actions">
93+
<a href="/" class="btn esh-button esh-button-secondary">
94+
[ Cancel ]
95+
</a>
5596

56-
<dt>
57-
Picture name
58-
</dt>
97+
<button class="btn esh-button esh-button-primary" @onclick="Delete_Click">
98+
[ Delete ]
99+
</button>
59100

60-
<dd>
61-
@_item.PictureFileName
62-
</dd>
63-
64-
<dt>
65-
Stock
66-
</dt>
67-
68-
<dd>
69-
@_item.AvailableStock
70-
</dd>
71-
72-
<dt>
73-
Restock
74-
</dt>
75-
76-
<dd>
77-
@_item.RestockThreshold
78-
</dd>
79-
80-
<dt>
81-
Max stock
82-
</dt>
83-
84-
<dd>
85-
@_item.MaxStockThreshold
86-
</dd>
87-
88-
<dt></dt>
101+
</dd>
89102

103+
</dl>
104+
</div>
105+
}
106+
else
107+
{
108+
<h3 class="esh-body-sub-title">Item not found</h3>
109+
<dl class="col-md-6 dl-horizontal">
90110
<dd class="text-right esh-button-actions">
91111
<a href="/" class="btn esh-button esh-button-secondary">
92112
[ Cancel ]
93113
</a>
94-
<button class="btn esh-button esh-button-primary" @onclick="Delete_Click">
95-
[ Delete ]
96-
</button>
97114
</dd>
98-
99115
</dl>
100-
</div>
116+
}
101117
</div>
102118

103119
@code {
104120
[Parameter]
105121
public int Id { get; set; }
106122

107-
private CatalogItem _item;
123+
private CatalogItem? _item;
108124

109125
protected override void OnInitialized()
110126
{
@@ -115,7 +131,10 @@
115131

116132
private void Delete_Click()
117133
{
118-
CatalogService.RemoveCatalogItem(_item);
134+
if (_item != null)
135+
{
136+
CatalogService.RemoveCatalogItem(_item);
137+
}
119138

120139
NavigationManager.NavigateTo("/");
121140
}

0 commit comments

Comments
 (0)