I make web api return message Not Matched Excel when flag areIdentical is false
and when flag areIdentical is true return file
What I have Tried
web api
[Route("ExportNxp")]
public IActionResult ExportNxp(bool areIdentical)
{
if (areIdentical == false)
{
return OK("Not Matched Excel");
}
else
{
return PhysicalFile(zipPath, "application/zip", Path.GetFileName(zipPath));
}
}
service.ts
PostUploadzipNxp(file:any):Observable<any>
{
formData.append('file', file,file.name);
return this.http.post('http://localhost:61265/api/Z2Delivery/ExportNxp/', formData,{observe: 'response', responseType: 'blob' });
}
component.ts
this._dataService.PostUploadzipNxp(this.fileToUpload)
.subscribe(blob => {
saveAs(blob.body, this.fileToUpload?.name +'.zip');
});
Result I need
if (areIdentical == false)
{
display message "Not Matched Excel" on angular component
}