I am attempting to update a specific resource by accessing it through the PUT method in an Angular service.
RollBackBatchById(selectedBatchId: number) {
const params = new HttpParams();
params.append('resourceId', resourceId.toString());
let headers = new HttpHeaders();
headers.append('Content-Type', 'multipart/form-data');
headers.append('Accept', 'application/json');
const httpOptions = { headers: headers };
return this._httpClient.put(this.base_url + 'api/WebApi/UpdateResource', { params: params })
.subscribe((res: Response) => {
});
}
Within my WebApi Controller:
[HttpPut]
[Route("UpdateResource")]
public TransactionResult UpdateResource([FromQuery]string resourceId)
{
var id = resourceId;
}
However, I am encountering an issue where the resourceId is arriving as null when accessed and checking the network activity does not show the resourceId appended to the URL.
If anyone could offer assistance with solving this problem, I would greatly appreciate it.