I have the following controller method:
[HttpPost]
[Route("SomeRoute")]
public byte[] MyMethod([FromBody] string ID)
{
byte[] mybytearray = db.get
This is my approach its worked for me
WEP API Method
[HttpGet]
[Route("pdfReport")]
public byte[] ReportMRWiseCurrentStatus()
{
byte[] resultsarray = _materialRequestReportService.ReportMRWiseCurrentStatus();
return resultsarray;
}
The Client
using (var client = new HttpClient())
{
var response = client.GetAsync(webApiUrl);
if (response.Result.IsSuccessStatusCode)
{
var result = response.Result.Content.ReadAsStringAsync().Result.Replace("\"", string.Empty);
var bytearray=Convert.FromBase64String(result);
System.IO.File.WriteAllBytes(@"C:\DB\newpdfAmila.pdf", bytearray);
}
}