Surya
Surya

Reputation: 265

How to handle null or empty value in FileContentResult return type in c#

I have a method to download files with return type FileContentResult

am getting byte array from API and downloading file from that but not getting how to handle if i get null value from api.

 public FileContentResult DownloadEID()
 {
   byte[] ContentBody = "api returns byte array";

   return File(ContentBody,System.Net.Mime.MediaTypeNames.Application.Pdf,"abc.pdf");
 }

but how to handle return type if i get null value from api?

Thanks

Upvotes: 1

Views: 982

Answers (0)

Related Questions