Skip to content

Commit aecc5f8

Browse files
Merge pull request #3 from Backiaraj/datepicker
Update the project
2 parents 12f7584 + 8228e9f commit aecc5f8

31 files changed

+392
-373
lines changed

AddingDatePicker.csproj

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net7.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Syncfusion.Blazor.Calendars" Version="23.1.39" />
11+
<PackageReference Include="Syncfusion.Blazor.Themes" Version="23.1.39" />
12+
</ItemGroup>
13+
14+
</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.29424.173
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.4.33213.308
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyBlazorProject", "MyBlazorProject.csproj", "{3D217D2E-6175-4E79-ADBA-82A1EAA8196F}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddingDatePicker", "AddingDatePicker.csproj", "{5798E52C-415E-4EC9-92DE-B8D8D3505319}"
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-
{3D217D2E-6175-4E79-ADBA-82A1EAA8196F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15-
{3D217D2E-6175-4E79-ADBA-82A1EAA8196F}.Debug|Any CPU.Build.0 = Debug|Any CPU
16-
{3D217D2E-6175-4E79-ADBA-82A1EAA8196F}.Release|Any CPU.ActiveCfg = Release|Any CPU
17-
{3D217D2E-6175-4E79-ADBA-82A1EAA8196F}.Release|Any CPU.Build.0 = Release|Any CPU
14+
{5798E52C-415E-4EC9-92DE-B8D8D3505319}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{5798E52C-415E-4EC9-92DE-B8D8D3505319}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{5798E52C-415E-4EC9-92DE-B8D8D3505319}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{5798E52C-415E-4EC9-92DE-B8D8D3505319}.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 = {C9FA3A93-DE4C-4190-BD3A-091E3A884F28}
23+
SolutionGuid = {65FF0191-8A07-4C22-B0B2-033E4AF69A14}
2424
EndGlobalSection
2525
EndGlobal

App.razor

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
2-
<Router AppAssembly="@typeof(Program).Assembly">
1+
<Router AppAssembly="@typeof(App).Assembly">
32
<Found Context="routeData">
43
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
4+
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
55
</Found>
66
<NotFound>
7+
<PageTitle>Not found</PageTitle>
78
<LayoutView Layout="@typeof(MainLayout)">
8-
<p>Sorry, there's nothing at this address.</p>
9+
<p role="alert">Sorry, there's nothing at this address.</p>
910
</LayoutView>
1011
</NotFound>
1112
</Router>

Data/WeatherForecast.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
using System;
2-
3-
namespace MyBlazorProject.Data
1+
namespace AddingDatePicker.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
}
15-
}
13+
}

Data/WeatherForecastService.cs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
1-
using System;
2-
using System.Linq;
3-
using System.Threading.Tasks;
4-
5-
namespace MyBlazorProject.Data
1+
namespace AddingDatePicker.Data
62
{
73
public class WeatherForecastService
84
{
95
private static readonly string[] Summaries = new[]
106
{
11-
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
12-
};
7+
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
8+
};
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
}
25-
}
20+
}

MyBlazorProject.csproj

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

Pages/Counter.razor

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
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

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 AddingDatePicker.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>

Pages/Error.cshtml.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
using Microsoft.AspNetCore.Mvc.RazorPages;
3+
using System.Diagnostics;
4+
5+
namespace AddingDatePicker.Pages
6+
{
7+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
8+
[IgnoreAntiforgeryToken]
9+
public class ErrorModel : PageModel
10+
{
11+
public string? RequestId { get; set; }
12+
13+
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
14+
15+
private readonly ILogger<ErrorModel> _logger;
16+
17+
public ErrorModel(ILogger<ErrorModel> logger)
18+
{
19+
_logger = logger;
20+
}
21+
22+
public void OnGet()
23+
{
24+
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
25+
}
26+
}
27+
}

Pages/Error.razor

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

0 commit comments

Comments
 (0)