File tree 10 files changed +19
-15
lines changed
10 files changed +19
-15
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ public interface ICounterClientDef
16
16
public interface IWeatherForecastClientDef
17
17
{
18
18
[ Get ( "getForecast" ) ]
19
- Task < WeatherForecast [ ] > GetForecast ( Moment startDate , CancellationToken cancellationToken = default ) ;
19
+ Task < WeatherForecast [ ] > GetForecast ( DateTime startDate , CancellationToken cancellationToken = default ) ;
20
20
}
21
21
22
22
[ BasePath ( "chat" ) ]
Original file line number Diff line number Diff line change 3
3
public interface IWeatherForecastService
4
4
{
5
5
[ ComputeMethod ]
6
- Task < WeatherForecast [ ] > GetForecast ( Moment startDate , CancellationToken cancellationToken = default ) ;
6
+ Task < WeatherForecast [ ] > GetForecast ( DateTime startDate , CancellationToken cancellationToken = default ) ;
7
7
}
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ namespace Samples.HelloBlazorHybrid.Abstractions;
2
2
3
3
public class WeatherForecast
4
4
{
5
- public Moment Date { get ; set ; }
5
+ public DateTime Date { get ; set ; }
6
6
public int TemperatureC { get ; set ; }
7
7
public int TemperatureF => 32 + ( int ) ( TemperatureC / 0.5556 ) ;
8
8
public string Summary { get ; set ; } = "" ;
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ public WeatherForecastController(IWeatherForecastService forecast)
14
14
=> _forecast = forecast ;
15
15
16
16
[ HttpGet , Publish ]
17
- public Task < WeatherForecast [ ] > GetForecast ( Moment startDate , CancellationToken cancellationToken = default )
17
+ public Task < WeatherForecast [ ] > GetForecast ( DateTime startDate ,
18
+ CancellationToken cancellationToken = default )
18
19
=> _forecast . GetForecast ( startDate , cancellationToken ) ;
19
20
}
Original file line number Diff line number Diff line change 1
1
<script src =" https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity =" sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin =" anonymous" ></script >
2
2
<
script src =
" https://cdn.jsdelivr.net/npm/[email protected] /dist/umd/popper.min.js" integrity =
" sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin =
" anonymous" ></
script >
3
3
<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 >
Original file line number Diff line number Diff line change @@ -10,12 +10,12 @@ public class WeatherForecastService : IWeatherForecastService
10
10
11
11
[ ComputeMethod ( AutoInvalidationDelay = 1 ) ]
12
12
public virtual Task < WeatherForecast [ ] > GetForecast (
13
- Moment startDate , CancellationToken cancellationToken = default )
13
+ DateTime startDate , CancellationToken cancellationToken = default )
14
14
{
15
15
var rng = new Random ( ) ;
16
16
return Task . FromResult ( Enumerable . Range ( 1 , 5 ) . Select ( index => new WeatherForecast
17
17
{
18
- Date = startDate . ToDateTime ( ) . AddDays ( index ) ,
18
+ Date = startDate . AddDays ( index ) ,
19
19
TemperatureC = rng . Next ( - 20 , 55 ) ,
20
20
Summary = Summaries [ rng . Next ( Summaries . Length ) ]
21
21
} ) . ToArray ( ) ) ;
Original file line number Diff line number Diff line change 1
1
@page " /fetchdata"
2
2
@using System .Threading
3
3
@using Samples .HelloBlazorHybrid .Abstractions
4
- @inherits MixedStateComponent <Samples .HelloBlazorHybrid .Abstractions .WeatherForecast [], Moment >
4
+ @inherits MixedStateComponent <Samples .HelloBlazorHybrid .Abstractions .WeatherForecast [], DateTime >
5
5
@inject IWeatherForecastService WeatherForecast
6
6
7
7
@{
32
32
@foreach ( var forecast in state )
33
33
{
34
34
<tr >
35
- <td >@forecast.Date.ToDateTime(). ToShortDateString() </td >
35
+ <td >@forecast.Date.ToShortDateString() </td >
36
36
<td >@forecast.TemperatureC </td >
37
37
<td >@forecast.TemperatureF </td >
38
38
<td >@forecast.Summary </td >
42
42
</table >
43
43
44
44
@code {
45
- protected override MutableState <Moment >.Options GetMutableStateOptions ()
45
+ protected override MutableState <DateTime >.Options GetMutableStateOptions ()
46
46
=> new () { InitialValue = DateTime .Today } ;
47
47
48
48
protected override async Task <WeatherForecast [] > ComputeState (CancellationToken cancellationToken )
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ namespace Samples.HelloBlazorServer.Models;
2
2
3
3
public class WeatherForecast
4
4
{
5
- public Moment Date { get ; set ; }
5
+ public DateTime Date { get ; set ; }
6
6
public int TemperatureC { get ; set ; }
7
7
public int TemperatureF => 32 + ( int ) ( TemperatureC / 0.5556 ) ;
8
8
public string Summary { get ; set ; } = "" ;
Original file line number Diff line number Diff line change 1
1
@page " /fetchdata"
2
2
@using System .Threading
3
- @inherits MixedStateComponent <WeatherForecast [], Moment >
3
+ @inherits MixedStateComponent <WeatherForecast [], DateTime >
4
4
@inject WeatherForecastService WeatherForecast
5
5
6
6
@{
31
31
@foreach ( var forecast in state )
32
32
{
33
33
<tr >
34
- <td >@forecast.Date.ToDateTime(). ToShortDateString() </td >
34
+ <td >@forecast.Date.ToShortDateString() </td >
35
35
<td >@forecast.TemperatureC </td >
36
36
<td >@forecast.TemperatureF </td >
37
37
<td >@forecast.Summary </td >
41
41
</table >
42
42
43
43
@code {
44
- protected override MutableState <Moment >.Options GetMutableStateOptions ()
44
+ protected override MutableState <DateTime >.Options GetMutableStateOptions ()
45
45
=> new () { InitialValue = DateTime .Today } ;
46
46
47
47
protected override Task <WeatherForecast [] > ComputeState (CancellationToken cancellationToken )
Original file line number Diff line number Diff line change @@ -10,12 +10,12 @@ public class WeatherForecastService
10
10
11
11
[ ComputeMethod ( AutoInvalidationDelay = 1 ) ]
12
12
public virtual Task < WeatherForecast [ ] > GetForecast (
13
- Moment startDate , CancellationToken cancellationToken = default )
13
+ DateTime startDate , CancellationToken cancellationToken = default )
14
14
{
15
15
var rng = new Random ( ) ;
16
16
return Task . FromResult ( Enumerable . Range ( 1 , 5 ) . Select ( index => new WeatherForecast
17
17
{
18
- Date = startDate . ToDateTime ( ) . AddDays ( index ) ,
18
+ Date = startDate . AddDays ( index ) ,
19
19
TemperatureC = rng . Next ( - 20 , 55 ) ,
20
20
Summary = Summaries [ rng . Next ( Summaries . Length ) ]
21
21
} ) . ToArray ( ) ) ;
You can’t perform that action at this time.
0 commit comments