I my backend C Sharp API, I have the below Post controller:
public async Task<ActionResult<bool>> UploadItem(SupplierType supplierType)
{
...
}
SupplierType is an Enum:
public enum SupplierType
{
Local,
International,
Own
}
In my front-end, I call the controller api as below:
UploadData(supplier: string): Observable<boolean> {
const httpOptions: { headers: HttpHeaders } = { headers: new HttpHeaders({ 'Content-Type': 'application/json' }) };
return this.http.post<boolean>(`localhost/UploadItem`, supplier, httpOptions);
}
The upload data method takes the value from a ng-select component and passes a string with value "0","1","2" as value.
But my controller is not being invoked. Is there a specific way to invoke controllers with enum parameter from angular?