File tree Expand file tree Collapse file tree 4 files changed +39
-40
lines changed
Expand file tree Collapse file tree 4 files changed +39
-40
lines changed Original file line number Diff line number Diff line change 1+ using Scalar . AspNetCore ;
2+
13var builder = WebApplication . CreateBuilder ( args ) ;
24
35// Add services to the container.
Original file line number Diff line number Diff line change 1- namespace FrontEnd . Data
1+ namespace FrontEnd . Data ;
2+
3+ public class WeatherForecast
24{
3- public class WeatherForecast
4- {
5- public DateOnly Date { get ; set ; }
5+ public DateOnly Date { get ; set ; }
66
7- public int TemperatureC { get ; set ; }
7+ public int TemperatureC { get ; set ; }
88
9- public int TemperatureF => 32 + ( int ) ( TemperatureC / 0.5556 ) ;
9+ public int TemperatureF => 32 + ( int ) ( TemperatureC / 0.5556 ) ;
1010
11- public string ? Summary { get ; set ; }
12- }
13- }
11+ public string ? Summary { get ; set ; }
12+ }
Original file line number Diff line number Diff line change 1- namespace FrontEnd . Data
2- {
3- public class WeatherForecastClient
4- {
5- private HttpClient _httpClient ;
6- private ILogger < WeatherForecastClient > _logger ;
1+ namespace FrontEnd . Data ;
72
8- public WeatherForecastClient ( HttpClient httpClient , ILogger < WeatherForecastClient > logger )
9- {
10- _httpClient = httpClient ;
11- _logger = logger ;
12- }
3+ public class WeatherForecastClient
4+ {
5+ private HttpClient _httpClient ;
6+ private ILogger < WeatherForecastClient > _logger ;
137
14- public async Task < WeatherForecast [ ] > GetForecastAsync ( DateTime ? startDate )
15- => await _httpClient . GetFromJsonAsync < WeatherForecast [ ] > ( $ "WeatherForecast?startDate={ startDate } ") ;
8+ public WeatherForecastClient ( HttpClient httpClient , ILogger < WeatherForecastClient > logger )
9+ {
10+ _httpClient = httpClient ;
11+ _logger = logger ;
1612 }
17- }
13+
14+ public async Task < WeatherForecast [ ] > GetForecastAsync ( DateTime ? startDate )
15+ => await _httpClient . GetFromJsonAsync < WeatherForecast [ ] > ( $ "WeatherForecast?startDate={ startDate } ") ?? [ ] ;
16+ }
Original file line number Diff line number Diff line change 22using Microsoft . AspNetCore . Mvc . RazorPages ;
33using System . Diagnostics ;
44
5- namespace FrontEnd . Pages
5+ namespace FrontEnd . Pages ;
6+
7+ [ ResponseCache ( Duration = 0 , Location = ResponseCacheLocation . None , NoStore = true ) ]
8+ [ IgnoreAntiforgeryToken ]
9+ public class ErrorModel : PageModel
610{
7- [ ResponseCache ( Duration = 0 , Location = ResponseCacheLocation . None , NoStore = true ) ]
8- [ IgnoreAntiforgeryToken ]
9- public class ErrorModel : PageModel
10- {
11- public string ? RequestId { get ; set ; }
11+ public string ? RequestId { get ; set ; }
1212
13- public bool ShowRequestId => ! string . IsNullOrEmpty ( RequestId ) ;
13+ public bool ShowRequestId => ! string . IsNullOrEmpty ( RequestId ) ;
1414
15- private readonly ILogger < ErrorModel > _logger ;
15+ private readonly ILogger < ErrorModel > _logger ;
1616
17- public ErrorModel ( ILogger < ErrorModel > logger )
18- {
19- _logger = logger ;
20- }
17+ public ErrorModel ( ILogger < ErrorModel > logger )
18+ {
19+ _logger = logger ;
20+ }
2121
22- public void OnGet ( )
23- {
24- RequestId = Activity . Current ? . Id ?? HttpContext . TraceIdentifier ;
25- }
22+ public void OnGet ( )
23+ {
24+ RequestId = Activity . Current ? . Id ?? HttpContext . TraceIdentifier ;
2625 }
27- }
26+ }
You can’t perform that action at this time.
0 commit comments