public ServerRFD ServerResponse([FromBody] ClientRFW clientRFWRequestBody) { CheckForBelowOneParameters(clientRFWRequestBody); ServerRFD serverRFD = new ServerRFD(); serverRFD.Batches = new List <Batch>(); List <Workload> workloadList = new List <Workload>(GetBenchmarkType(clientRFWRequestBody.BenchmarkType)); List <double> allColumnValuesList = new List <double>(GetAllWorkloadColumnValues(clientRFWRequestBody.WorkloadMetric, workloadList)); List <Batch> allBatchesList = new List <Batch>(GetAllBatches(clientRFWRequestBody.BatchUnit, allColumnValuesList)); int startIndex = clientRFWRequestBody.BatchID - 1; int endIndex = 0; if ((startIndex + clientRFWRequestBody.BatchSize) <= allBatchesList.Count()) { endIndex = startIndex + clientRFWRequestBody.BatchSize; } else { endIndex = allBatchesList.Count(); } for (int i = startIndex; i < endIndex; i++) { serverRFD.Batches.Add(allBatchesList[i]); } serverRFD.RFDID = clientRFWRequestBody.RFWID; serverRFD.LastBatchID = endIndex; return(serverRFD); }
public void CheckForBelowOneParameters(ClientRFW client) { if (client.RFWID < 1) { client.RFWID = 1; } if (client.BatchID < 1) { client.BatchID = 1; } if (client.BatchUnit < 1) { client.BatchUnit = 1; } if (client.BatchSize < 1) { client.BatchSize = 1; } }