public IActionResult OnPost() { if (ModelState.IsValid) { var fileName = FileUploadManager.UploadSingleFile(UploadFileModel.File, _hostEnvironment); var text = FileDataExtractor.Extract(_hostEnvironment.WebRootPath + "\\uploads\\" + fileName); FileIndexingManager.AddToIndex(_hostEnvironment, UploadFileModel.Title, text, fileName); Message = $"Document had been uploaded successfully."; } return(Page()); }