Skip to content

Commit 2dc6c1d

Browse files
committed
Revert "fix: #488"
This reverts commit b725c4a.
1 parent c9a534c commit 2dc6c1d

File tree

10 files changed

+19
-15
lines changed

10 files changed

+19
-15
lines changed

src/HelloBlazorHybrid/Abstractions/Clients.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public interface ICounterClientDef
1616
public interface IWeatherForecastClientDef
1717
{
1818
[Get("getForecast")]
19-
Task<WeatherForecast[]> GetForecast(Moment startDate, CancellationToken cancellationToken = default);
19+
Task<WeatherForecast[]> GetForecast(DateTime startDate, CancellationToken cancellationToken = default);
2020
}
2121

2222
[BasePath("chat")]

src/HelloBlazorHybrid/Abstractions/IWeatherForecastService.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
public interface IWeatherForecastService
44
{
55
[ComputeMethod]
6-
Task<WeatherForecast[]> GetForecast(Moment startDate, CancellationToken cancellationToken = default);
6+
Task<WeatherForecast[]> GetForecast(DateTime startDate, CancellationToken cancellationToken = default);
77
}

src/HelloBlazorHybrid/Abstractions/WeatherForecast.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ namespace Samples.HelloBlazorHybrid.Abstractions;
22

33
public class WeatherForecast
44
{
5-
public Moment Date { get; set; }
5+
public DateTime Date { get; set; }
66
public int TemperatureC { get; set; }
77
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
88
public string Summary { get; set; } = "";

src/HelloBlazorHybrid/Server/Controllers/WeatherForecastController.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public WeatherForecastController(IWeatherForecastService forecast)
1414
=> _forecast = forecast;
1515

1616
[HttpGet, Publish]
17-
public Task<WeatherForecast[]> GetForecast(Moment startDate, CancellationToken cancellationToken = default)
17+
public Task<WeatherForecast[]> GetForecast(DateTime startDate,
18+
CancellationToken cancellationToken = default)
1819
=> _forecast.GetForecast(startDate, cancellationToken);
1920
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
22
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
33
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
4+
5+
<script src="_content/Blazorise/blazorise.js"></script>
6+
<script src="_content/Blazorise.Bootstrap/blazorise.bootstrap.js"></script>

src/HelloBlazorHybrid/Services/WeatherForecastService.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ public class WeatherForecastService : IWeatherForecastService
1010

1111
[ComputeMethod(AutoInvalidationDelay = 1)]
1212
public virtual Task<WeatherForecast[]> GetForecast(
13-
Moment startDate, CancellationToken cancellationToken = default)
13+
DateTime startDate, CancellationToken cancellationToken = default)
1414
{
1515
var rng = new Random();
1616
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
1717
{
18-
Date = startDate.ToDateTime().AddDays(index),
18+
Date = startDate.AddDays(index),
1919
TemperatureC = rng.Next(-20, 55),
2020
Summary = Summaries[rng.Next(Summaries.Length)]
2121
}).ToArray());

src/HelloBlazorHybrid/UI/Pages/FetchData.razor

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@page "/fetchdata"
22
@using System.Threading
33
@using Samples.HelloBlazorHybrid.Abstractions
4-
@inherits MixedStateComponent<Samples.HelloBlazorHybrid.Abstractions.WeatherForecast[], Moment>
4+
@inherits MixedStateComponent<Samples.HelloBlazorHybrid.Abstractions.WeatherForecast[], DateTime>
55
@inject IWeatherForecastService WeatherForecast
66

77
@{
@@ -32,7 +32,7 @@
3232
@foreach (var forecast in state)
3333
{
3434
<tr>
35-
<td>@forecast.Date.ToDateTime().ToShortDateString()</td>
35+
<td>@forecast.Date.ToShortDateString()</td>
3636
<td>@forecast.TemperatureC</td>
3737
<td>@forecast.TemperatureF</td>
3838
<td>@forecast.Summary</td>
@@ -42,7 +42,7 @@
4242
</table>
4343

4444
@code {
45-
protected override MutableState<Moment>.Options GetMutableStateOptions()
45+
protected override MutableState<DateTime>.Options GetMutableStateOptions()
4646
=> new () { InitialValue = DateTime.Today };
4747

4848
protected override async Task<WeatherForecast[]> ComputeState(CancellationToken cancellationToken)

src/HelloBlazorServer/Models/WeatherForecast.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ namespace Samples.HelloBlazorServer.Models;
22

33
public class WeatherForecast
44
{
5-
public Moment Date { get; set; }
5+
public DateTime Date { get; set; }
66
public int TemperatureC { get; set; }
77
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
88
public string Summary { get; set; } = "";

src/HelloBlazorServer/Pages/FetchData.razor

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@page "/fetchdata"
22
@using System.Threading
3-
@inherits MixedStateComponent<WeatherForecast[], Moment>
3+
@inherits MixedStateComponent<WeatherForecast[], DateTime>
44
@inject WeatherForecastService WeatherForecast
55

66
@{
@@ -31,7 +31,7 @@
3131
@foreach (var forecast in state)
3232
{
3333
<tr>
34-
<td>@forecast.Date.ToDateTime().ToShortDateString()</td>
34+
<td>@forecast.Date.ToShortDateString()</td>
3535
<td>@forecast.TemperatureC</td>
3636
<td>@forecast.TemperatureF</td>
3737
<td>@forecast.Summary</td>
@@ -41,7 +41,7 @@
4141
</table>
4242

4343
@code {
44-
protected override MutableState<Moment>.Options GetMutableStateOptions()
44+
protected override MutableState<DateTime>.Options GetMutableStateOptions()
4545
=> new () { InitialValue = DateTime.Today };
4646

4747
protected override Task<WeatherForecast[]> ComputeState(CancellationToken cancellationToken)

src/HelloBlazorServer/Services/WeatherForecastService.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ public class WeatherForecastService
1010

1111
[ComputeMethod(AutoInvalidationDelay = 1)]
1212
public virtual Task<WeatherForecast[]> GetForecast(
13-
Moment startDate, CancellationToken cancellationToken = default)
13+
DateTime startDate, CancellationToken cancellationToken = default)
1414
{
1515
var rng = new Random();
1616
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
1717
{
18-
Date = startDate.ToDateTime().AddDays(index),
18+
Date = startDate.AddDays(index),
1919
TemperatureC = rng.Next(-20, 55),
2020
Summary = Summaries[rng.Next(Summaries.Length)]
2121
}).ToArray());

0 commit comments

Comments
 (0)