public IActionResult GetImage(string uniquePath) { EntityConnection connection = new EntityConnection("tbl_medicalstaff"); if (connection.CheckImage(uniquePath) == true) { string path = "/home/unimed/wwwroot/" + uniquePath; using (var stream = new FileStream(path, FileMode.Open, FileAccess.ReadWrite)) { return(PhysicalFile(path, "image/jpg")); } } else { obj = new { message = "Image does not exist" }; return(BadRequest(obj)); } }