Skip to content

Commit 20f75b5

Browse files
committed
Update the project
1 parent c07eeb1 commit 20f75b5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+538
-1569
lines changed
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
<Router AppAssembly="@typeof(Program).Assembly">
1+
<Router AppAssembly="@typeof(App).Assembly">
22
<Found Context="routeData">
33
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
4+
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
45
</Found>
56
<NotFound>
7+
<PageTitle>Not found</PageTitle>
68
<LayoutView Layout="@typeof(MainLayout)">
7-
<p>Sorry, there's nothing at this address.</p>
9+
<p role="alert">Sorry, there's nothing at this address.</p>
810
</LayoutView>
911
</NotFound>
1012
</Router>

WebAPI/Controllers/DefaultController.cs renamed to Controllers/DefaultController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
using Microsoft.AspNetCore.Http;
66
using Microsoft.AspNetCore.Mvc;
77
using Microsoft.Extensions.Primitives;
8-
using WebAPI.Data;
8+
using CrudAsynchronousSample.Data;
99

10-
namespace WebAPI.Controllers
10+
namespace CrudAsynchronousSample.Controllers
1111
{
1212
[Route("api/[controller]")]
1313
[ApiController]
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Web">
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
57
</PropertyGroup>
68

79
<ItemGroup>
8-
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0" />
9-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0" />
10-
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0">
10+
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.14" />
11+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.14" />
12+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.14">
1113
<PrivateAssets>all</PrivateAssets>
1214
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1315
</PackageReference>
14-
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.0.0" />
15-
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0" />
16-
<PackageReference Include="Syncfusion.EJ2.Blazor" Version="17.3.0.18-beta" />
16+
<PackageReference Include="Syncfusion.Blazor.Grid" Version="24.1.41" />
17+
<PackageReference Include="Syncfusion.Blazor.Themes" Version="24.1.41" />
1718
</ItemGroup>
1819

1920
</Project>
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.29319.158
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.8.34330.188
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebAPI", "WebAPI.csproj", "{3C37A581-AC92-4FC2-A3C6-8028603C10A8}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CrudAsynchronousSample", "CrudAsynchronousSample.csproj", "{4DC34B6B-83BF-44AF-B09A-7876DE4319FE}"
77
EndProject
88
Global
99
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1010
Debug|Any CPU = Debug|Any CPU
1111
Release|Any CPU = Release|Any CPU
1212
EndGlobalSection
1313
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14-
{3C37A581-AC92-4FC2-A3C6-8028603C10A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15-
{3C37A581-AC92-4FC2-A3C6-8028603C10A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
16-
{3C37A581-AC92-4FC2-A3C6-8028603C10A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
17-
{3C37A581-AC92-4FC2-A3C6-8028603C10A8}.Release|Any CPU.Build.0 = Release|Any CPU
14+
{4DC34B6B-83BF-44AF-B09A-7876DE4319FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{4DC34B6B-83BF-44AF-B09A-7876DE4319FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{4DC34B6B-83BF-44AF-B09A-7876DE4319FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{4DC34B6B-83BF-44AF-B09A-7876DE4319FE}.Release|Any CPU.Build.0 = Release|Any CPU
1818
EndGlobalSection
1919
GlobalSection(SolutionProperties) = preSolution
2020
HideSolutionNode = FALSE
2121
EndGlobalSection
2222
GlobalSection(ExtensibilityGlobals) = postSolution
23-
SolutionGuid = {D927B854-8D46-454E-B26D-FA85C6589BE9}
23+
SolutionGuid = {07B2A808-115E-416E-86CB-892D5BEB8223}
2424
EndGlobalSection
2525
EndGlobal

WebAPI/Data/OrderService.cs renamed to Data/OrderService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
using System.Net.Http;
66
using System.Text;
77
using System.Threading.Tasks;
8-
using WebAPI.Data;
8+
using CrudAsynchronousSample.Data;
99

10-
namespace WebAPI.Data
10+
namespace CrudAsynchronousSample.Data
1111
{
1212
public class OrderService
1313
{
14-
string baseUrl = "http://localhost:50838/";
14+
string baseUrl = "https://localhost:44377/";
1515
public async Task<List<Orders>> GetOrdersAsync()
1616
{
1717
HttpClient http = new HttpClient();

WebAPI/Data/Orders.cs renamed to Data/Orders.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using System.Linq;
44
using System.Threading.Tasks;
55

6-
namespace WebAPI.Data
6+
namespace CrudAsynchronousSample.Data
77
{
88
public class Orders
99
{
@@ -17,21 +17,14 @@ public Orders(long OrderId, string CustomerId, Nullable<int> EmployeeId, double
1717
this.CustomerID = CustomerId;
1818
this.EmployeeID = EmployeeId;
1919
this.Freight = Freight;
20-
//this.Time = Time;
2120
this.OrderDate = OrderDate;
22-
//this.HireDate = HireDate;
23-
// this.HireDate1 = HireDate1;
2421
this.ShipCity = ShipCity;
2522
}
2623
public long OrderID { get; set; }
2724
public string CustomerID { get; set; }
2825
public Nullable<int> EmployeeID { get; set; }
29-
30-
// public TimeSpan? Time { get; set; }
3126
public double Freight { get; set; }
3227
public DateTime OrderDate { get; set; }
33-
//public DateTimeOffset? HireDate { get; set; }
34-
//public DateTimeKind? HireDate1 { get; set; }
35-
public string ShipCity { get; set; }
28+
public string? ShipCity { get; set; }
3629
}
3730
}
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
using System;
2-
3-
namespace WebAPI.Data
1+
namespace CrudAsynchronousSample.Data
42
{
53
public class WeatherForecast
64
{
7-
public DateTime Date { get; set; }
5+
public DateOnly Date { get; set; }
86

97
public int TemperatureC { get; set; }
108

119
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
1210

13-
public string Summary { get; set; }
11+
public string? Summary { get; set; }
1412
}
1513
}

WebAPI/Data/WeatherForecastService.cs renamed to Data/WeatherForecastService.cs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
using System;
2-
using System.Linq;
3-
using System.Threading.Tasks;
4-
5-
namespace WebAPI.Data
1+
namespace CrudAsynchronousSample.Data
62
{
73
public class WeatherForecastService
84
{
@@ -11,14 +7,13 @@ public class WeatherForecastService
117
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
128
};
139

14-
public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate)
10+
public Task<WeatherForecast[]> GetForecastAsync(DateOnly startDate)
1511
{
16-
var rng = new Random();
1712
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
1813
{
1914
Date = startDate.AddDays(index),
20-
TemperatureC = rng.Next(-20, 55),
21-
Summary = Summaries[rng.Next(Summaries.Length)]
15+
TemperatureC = Random.Shared.Next(-20, 55),
16+
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
2217
}).ToArray());
2318
}
2419
}

WebAPI/Pages/Counter.razor renamed to Pages/Counter.razor

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
@page "/counter"
22

3+
<PageTitle>Counter</PageTitle>
4+
35
<h1>Counter</h1>
46

5-
<p>Current count: @currentCount</p>
7+
<p role="status">Current count: @currentCount</p>
68

79
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
810

911
@code {
10-
int currentCount = 0;
12+
private int currentCount = 0;
1113

12-
void IncrementCount()
14+
private void IncrementCount()
1315
{
1416
currentCount++;
1517
}

Pages/Error.cshtml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
@page
2+
@model CrudAsynchronousSample.Pages.ErrorModel
3+
4+
<!DOCTYPE html>
5+
<html lang="en">
6+
7+
<head>
8+
<meta charset="utf-8" />
9+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
10+
<title>Error</title>
11+
<link href="~/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
12+
<link href="~/css/site.css" rel="stylesheet" asp-append-version="true" />
13+
</head>
14+
15+
<body>
16+
<div class="main">
17+
<div class="content px-4">
18+
<h1 class="text-danger">Error.</h1>
19+
<h2 class="text-danger">An error occurred while processing your request.</h2>
20+
21+
@if (Model.ShowRequestId)
22+
{
23+
<p>
24+
<strong>Request ID:</strong> <code>@Model.RequestId</code>
25+
</p>
26+
}
27+
28+
<h3>Development Mode</h3>
29+
<p>
30+
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
31+
</p>
32+
<p>
33+
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
34+
It can result in displaying sensitive information from exceptions to end users.
35+
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
36+
and restarting the app.
37+
</p>
38+
</div>
39+
</div>
40+
</body>
41+
42+
</html>

0 commit comments

Comments
 (0)