diff --git a/MyApp.Client/src/dtos.ts b/MyApp.Client/src/dtos.ts index 09b02e0..a89ecee 100644 --- a/MyApp.Client/src/dtos.ts +++ b/MyApp.Client/src/dtos.ts @@ -1,5 +1,5 @@ /* Options: -Date: 2024-02-18 12:11:40 +Date: 2024-02-28 19:37:38 Version: 8.13 Tip: To override a DTO option, remove "//" prefix before updating BaseUrl: https://localhost:5001 @@ -229,14 +229,14 @@ export class Booking extends AuditBase public constructor(init?: Partial) { super(init); (Object as any).assign(this, init); } } -export class WeatherForecast implements IGet +export class Forecast implements IGet { public date: string; public temperatureC: number; public summary?: string; public temperatureF: number; - public constructor(init?: Partial) { (Object as any).assign(this, init); } + public constructor(init?: Partial) { (Object as any).assign(this, init); } } export class PageStats @@ -440,14 +440,14 @@ export class Hello implements IReturn, IGet public createResponse() { return new HelloResponse(); } } -export class GetWeatherForecast implements IReturn, IGet +export class GetWeatherForecast implements IReturn, IGet { public date?: string; public constructor(init?: Partial) { (Object as any).assign(this, init); } public getTypeName() { return 'GetWeatherForecast'; } public getMethod() { return 'GET'; } - public createResponse() { return new Array(); } + public createResponse() { return new Array(); } } export class AdminData implements IReturn, IGet diff --git a/MyApp.Client/src/pages/weather.tsx b/MyApp.Client/src/pages/weather.tsx index 6cfe095..4dccc5d 100644 --- a/MyApp.Client/src/pages/weather.tsx +++ b/MyApp.Client/src/pages/weather.tsx @@ -1,19 +1,19 @@ import { useState, useEffect } from "react" import LayoutPage from "@/components/LayoutPage" import SrcPage from "@/components/SrcPage" -import { useClient } from "@/gateway"; -import { GetWeatherForecast, WeatherForecast } from "@/dtos" +import { useClient } from "@/gateway" +import { GetWeatherForecast, Forecast } from "@/dtos" import { columnDefs, DataTable, getCoreRowModel } from "@/components/DataTable.tsx" export default (): JSX.Element => { - const [results, setResults] = useState([]) const client = useClient() + const [forecasts, setForecasts] = useState([]) useEffect(() => { (async () => { const api = await client.api(new GetWeatherForecast()) if (api.succeeded) { - setResults(api.response!) + setForecasts(api.response!) } })() }, []) @@ -26,7 +26,7 @@ export default (): JSX.Element => { }) return ( - +
diff --git a/MyApp.ServiceInterface/MyServices.cs b/MyApp.ServiceInterface/MyServices.cs index af4d5d8..8d24cfd 100644 --- a/MyApp.ServiceInterface/MyServices.cs +++ b/MyApp.ServiceInterface/MyServices.cs @@ -18,7 +18,7 @@ public object Any(Hello request) public object Any(GetWeatherForecast request) { var rng = new Random(); - return Enumerable.Range(1, 5).Select(index => new WeatherForecast( + return Enumerable.Range(1, 5).Select(index => new Forecast( Date: (request.Date ?? DateOnly.FromDateTime(DateTime.Now)).AddDays(index), TemperatureC: rng.Next(-20, 55), Summary: summaries[rng.Next(summaries.Length)] diff --git a/MyApp.ServiceModel/Hello.cs b/MyApp.ServiceModel/Hello.cs index ee89fae..22f3678 100644 --- a/MyApp.ServiceModel/Hello.cs +++ b/MyApp.ServiceModel/Hello.cs @@ -13,12 +13,12 @@ public class HelloResponse public required string Result { get; set; } } -public class GetWeatherForecast : IGet, IReturn +public class GetWeatherForecast : IGet, IReturn { public required DateOnly? Date { get; set; } } -public record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary) : IGet, IReturn +public record Forecast(DateOnly Date, int TemperatureC, string? Summary) : IGet, IReturn { public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); }