public async Task <IActionResult> OnPostUploadAsync(IFormFile file) { var filePath = Path.GetTempFileName(); using (var stream = System.IO.File.Create(filePath)) { await file.CopyToAsync(stream); }; var filecontent = XDocument.Load(filePath); if (filecontent != null) { _ctx.ProcessXmlData(filecontent); System.IO.File.Delete(filePath); return(Ok(filecontent)); } else { return(BadRequest()); }; }