|
2 | 2 | // The Blazor Desktop Contributors licenses this file to you under the MIT license. |
3 | 3 | // See the LICENSE file in the project root for more information. |
4 | 4 |
|
5 | | -namespace BlazorDesktop.Data |
| 5 | +namespace BlazorDesktop.Sample.Data; |
| 6 | + |
| 7 | +/// <summary> |
| 8 | +/// The weather forecast service |
| 9 | +/// </summary> |
| 10 | +public class WeatherForecastService |
6 | 11 | { |
7 | 12 | /// <summary> |
8 | | - /// The weather forecast service |
| 13 | + /// The list of summaries |
9 | 14 | /// </summary> |
10 | | - public class WeatherForecastService |
| 15 | + private static readonly string[] s_summaries = new[] |
11 | 16 | { |
12 | | - /// <summary> |
13 | | - /// The list of summaries |
14 | | - /// </summary> |
15 | | - private static readonly string[] s_summaries = new[] |
16 | | - { |
17 | | - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" |
18 | | - }; |
| 17 | + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" |
| 18 | + }; |
19 | 19 |
|
20 | | - /// <summary> |
21 | | - /// Gets the weather forecast asynchronously |
22 | | - /// </summary> |
23 | | - /// <param name="startDate">The starting date</param> |
24 | | - /// <returns>An array of <see cref="WeatherForecast"/></returns> |
25 | | - public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate) |
| 20 | + /// <summary> |
| 21 | + /// Gets the weather forecast asynchronously |
| 22 | + /// </summary> |
| 23 | + /// <param name="startDate">The starting date</param> |
| 24 | + /// <returns>An array of <see cref="WeatherForecast"/></returns> |
| 25 | + public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate) |
| 26 | + { |
| 27 | + return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast |
26 | 28 | { |
27 | | - return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast |
28 | | - { |
29 | | - Date = startDate.AddDays(index), |
30 | | - TemperatureC = Random.Shared.Next(-20, 55), |
31 | | - Summary = s_summaries[Random.Shared.Next(s_summaries.Length)] |
32 | | - }).ToArray()); |
33 | | - } |
| 29 | + Date = startDate.AddDays(index), |
| 30 | + TemperatureC = Random.Shared.Next(-20, 55), |
| 31 | + Summary = s_summaries[Random.Shared.Next(s_summaries.Length)] |
| 32 | + }).ToArray()); |
34 | 33 | } |
35 | 34 | } |
0 commit comments