public async Task <ActionResult> ViewDataReturnSubmissionHistory(Guid pcsId, DataReturnSubmissionsHistoryOrderBy orderBy = DataReturnSubmissionsHistoryOrderBy.ComplianceYearDescending, int page = 1) { await SetBreadcrumb(pcsId, PcsAction.ViewSubmissionHistory); if (page < 1) { page = 1; } var model = new DataReturnSubmissionHistoryViewModel { OrderBy = orderBy }; using (var client = apiClient()) { var scheme = await client.SendAsync(User.GetAccessToken(), new GetSchemePublicInfo(pcsId)); if (scheme != null) { var getDataReturnSubmissionsHistoryResults = new GetDataReturnSubmissionsHistoryResults(scheme.SchemeId, scheme.OrganisationId, ordering: orderBy); var results = await client.SendAsync(User.GetAccessToken(), getDataReturnSubmissionsHistoryResults); if (results.Data != null) { model.Results = results.Data.ToPagedList(page - 1, DefaultPageSize, results.ResultCount); } } } return(View(model)); }
public async Task<ActionResult> ViewDataReturnSubmissionHistory(Guid pcsId, DataReturnSubmissionsHistoryOrderBy orderBy = DataReturnSubmissionsHistoryOrderBy.ComplianceYearDescending, int page = 1) { await SetBreadcrumb(pcsId, "View submission history"); if (page < 1) { page = 1; } var model = new DataReturnSubmissionHistoryViewModel(); model.OrderBy = orderBy; using (var client = apiClient()) { var scheme = await client.SendAsync(User.GetAccessToken(), new GetSchemePublicInfo(pcsId)); if (scheme != null) { var getDataReturnSubmissionsHistoryResults = new GetDataReturnSubmissionsHistoryResults(scheme.SchemeId, scheme.OrganisationId, ordering: orderBy); var results = await client.SendAsync(User.GetAccessToken(), getDataReturnSubmissionsHistoryResults); if (results.Data != null) { model.Results = results.Data.ToPagedList(page - 1, DefaultPageSize, results.ResultCount); } } } return View(model); }