Francis Irasa
Francis Irasa

Reputation: 1

GetAsync with object parameter value in asp.net core

In TypesScript, I have an interface defined as

export interface ClientReportParm {
 StartDate?: Date;
 EndDate?: Date;
}

I have a method that calls an API endpoint defined as

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 });
}

In C# However, I need to translate the above method code to a C# equivalent for ASP.NET Core. The line of code I need to use is

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???

Upvotes: 0

Views: 578

Answers (0)

Related Questions