public async Task <GetStudentsResult> GetStudents(string courseName, string continuationToken, int limit) { using (_logger.BeginScope("{CourseName}", courseName)) { var stopWatch = Stopwatch.StartNew(); GetStudentsResult result = await _studentStore.GetStudents(courseName, continuationToken, limit); _telemetryClient.TrackMetric("StudentStore.GetStudents.Time", stopWatch.ElapsedMilliseconds); return(result); } }
public async Task <IActionResult> GetStudents(string courseName, string continuationToken, int limit) { GetStudentsResult result = await _studentService.GetStudents(courseName, continuationToken, limit); string nextUri = null; if (!string.IsNullOrWhiteSpace(result.ContinuationToken)) { nextUri = $"api/courses/{courseName}/students?continuationToken={WebUtility.UrlEncode(result.ContinuationToken)}&limit={limit}"; } var response = new GetStudentsResponse { NextUri = nextUri, Students = result.Students }; return(Ok(response)); }