diff options
Diffstat (limited to 'backend/api/api/Controllers/FileController.cs')
-rw-r--r-- | backend/api/api/Controllers/FileController.cs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/backend/api/api/Controllers/FileController.cs b/backend/api/api/Controllers/FileController.cs index 68d2ebed..9baf6294 100644 --- a/backend/api/api/Controllers/FileController.cs +++ b/backend/api/api/Controllers/FileController.cs @@ -94,9 +94,9 @@ namespace api.Controllers return Ok(fileModel._id); } - [HttpGet("csvread/{hasHeader}/{fileId}")] + [HttpGet("csvread/{hasHeader}/{fileId}/{skipRows}/{takeRows}")] [Authorize(Roles = "User,Guest")] - public ActionResult<string> CsvRead(bool hasHeader, string fileId) + public ActionResult<string> CsvRead(bool hasHeader, string fileId, int skipRows = 0, int takeRows = 10) { string uploaderId = getUserId(); @@ -110,13 +110,12 @@ namespace api.Controllers if (hasHeader) - return String.Join("\n", System.IO.File.ReadLines(filePath).Take(11)); - else - return String.Join("\n", System.IO.File.ReadLines(filePath).Take(10)); + return String.Join("\n", System.IO.File.ReadLines(filePath).Skip(skipRows+1).Take(takeRows)); + else + return String.Join("\n", System.IO.File.ReadLines(filePath).Skip(skipRows).Take(takeRows)); } - [HttpPost("Csv")] [Authorize(Roles = "User,Guest")] [DisableRequestSizeLimit] |