public async Task<JArray> GetSectionsAsync(string accessToken, string userId, int? limit, int? offset) { Uri apiEndPoint = new Uri(String.Format(ApiHelper.BaseUrl + "/sections", userId)); if (limit != null) { apiEndPoint = apiEndPoint.AddQuery("limit", limit.ToString()); } if (offset != null) { apiEndPoint = apiEndPoint.AddQuery("offset", offset.ToString()); } return (await ApiHelper.CallApiForGetAsync(apiEndPoint.ToString(), accessToken)); }
public async Task<ActionResult> IndexAsync(int? limit, int? offset) { ViewBag.Title = "Classes"; var sectionService = new SectionDataService(); var sections = await sectionService.GetSectionsAsync(SessionInfo.Current.AccessToken, SessionInfo.Current.UserId, limit, offset) .ContinueWith(t => new SectionListViewModel { Sections = t.Result }); return View("Index", sections); }