在 TypesScript 中,我有一个接口定义为
export interface ClientReportParm {
StartDate?: Date;
EndDate?: Date;
}
我有一个调用定义为的 API 端点的方法
ClientReport(parm: ClientReportParm) {
this.searchParams = new HttpParams();
this.searchParams = this.searchParams.append('parm', JSON.stringify(parm));
return this.http.get('http://localhost:5000/api/service/retclientreport', { params:
this.searchParams });
}
在 C# 但是,我需要将上述方法代码转换为 ASP.NET Core 的 C# 等效项。我需要使用的代码行是
http.get(this.baseUrl + 'retclientreport', { params: this.searchParams });
// I have tried to do the following
// This is where I need to pass the stringified json object
var response = await client.GetAsync('http://localhost:5000/api/service/retclientreport',
param??); // How do I pass the equivalent json object here???