[HttpPost] // Sorts passed list and saves to file public ActionResult <string> SortNumbersList([FromBody] DataToSort pDataToSort) { try { if (pDataToSort.InputData.Length == 0 || pDataToSort.InputData == null) { return(BadRequest()); } SortingHelper vSorter = new SortingHelper(); int[] vSortedArray; try { vSortedArray = vSorter.SortNumbers(pDataToSort.InputData); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, "Error during array sorting: +" + Environment.NewLine + ex.StackTrace)); } return(Ok(gFilesHelper.SaveSortedData(vSortedArray))); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message)); } }