File tree Expand file tree Collapse file tree 10 files changed +19
-15
lines changed
Expand file tree Collapse file tree 10 files changed +19
-15
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ public interface ICounterClientDef
1616public 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" ) ]
Original file line number Diff line number Diff line change 33public interface IWeatherForecastService
44{
55 [ ComputeMethod ]
6- Task < WeatherForecast [ ] > GetForecast ( Moment startDate , CancellationToken cancellationToken = default ) ;
6+ Task < WeatherForecast [ ] > GetForecast ( DateTime startDate , CancellationToken cancellationToken = default ) ;
77}
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ namespace Samples.HelloBlazorHybrid.Abstractions;
22
33public 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 ; } = "" ;
Original file line number Diff line number Diff 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 number Diff line number Diff line change 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 >
Original file line number Diff line number Diff 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 ( ) ) ;
Original file line number Diff line number Diff line change 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@{
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 >
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 )
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ namespace Samples.HelloBlazorServer.Models;
22
33public 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 ; } = "" ;
Original file line number Diff line number Diff line change 11@page " /fetchdata"
22@using System .Threading
3- @inherits MixedStateComponent <WeatherForecast [], Moment >
3+ @inherits MixedStateComponent <WeatherForecast [], DateTime >
44@inject WeatherForecastService WeatherForecast
55
66@{
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 >
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 )
Original file line number Diff line number Diff 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 ( ) ) ;
You can’t perform that action at this time.
0 commit comments