public IActionResult Get(string uniqueName) { EntityConnection con = new EntityConnection("tbl_files"); if (con.CheckFile(uniqueName) == true) { string path = "/home/unimed/wwwroot/" + uniqueName; using (var stream = new FileStream(path, FileMode.Open, FileAccess.ReadWrite)) { return(PhysicalFile(path, "application/pdf")); } } else { objs = new { message = "File does not exist" }; return(BadRequest(objs)); } }