public async Task <ActionResult> ViewSubmissionHistory(Guid pcsId, SubmissionsHistoryOrderBy orderBy = SubmissionsHistoryOrderBy.ComplianceYearDescending, int page = 1) { await SetBreadcrumb(pcsId, PcsAction.ViewSubmissionHistory); if (page < 1) { page = 1; } var model = new SubmissionHistoryViewModel { OrderBy = orderBy }; using (var client = apiClient()) { var scheme = await client.SendAsync(User.GetAccessToken(), new GetSchemePublicInfo(pcsId)); if (scheme != null) { var getSubmissionsHistoryResults = new GetSubmissionsHistoryResults(scheme.SchemeId, scheme.OrganisationId, ordering: orderBy); var results = await client.SendAsync(User.GetAccessToken(), getSubmissionsHistoryResults); if (results.Data != null) { model.Results = results.Data.ToPagedList(page - 1, DefaultPageSize, results.ResultCount); } } } return(View(model)); }
private async Task<ActionResult> RetrieveSubmissionResults(int year, Guid schemeId, SubmissionsHistoryOrderBy orderBy) { if (Request != null && !Request.IsAjaxRequest()) { throw new InvalidOperationException(); } if (!ModelState.IsValid) { return Json(null, JsonRequestBehavior.AllowGet); } using (var client = apiClient()) { try { var schemeData = await client.SendAsync(User.GetAccessToken(), new GetSchemeById(schemeId)); var request = new GetSubmissionsHistoryResults(schemeId, schemeData.OrganisationId, year, orderBy, true); var searchResults = await client.SendAsync(User.GetAccessToken(), request); var model = new SubmissionsResultsViewModel { Year = year, Scheme = schemeId, Results = searchResults.Data, OrderBy = orderBy }; return PartialView("_submissionsResults", model); } catch (ApiBadRequestException ex) { this.HandleBadRequest(ex); throw; } } }
public Task<ActionResult> GetSubmissionResults(int year, Guid schemeId, SubmissionsHistoryOrderBy orderBy) { return RetrieveSubmissionResults(year, schemeId, orderBy); }
public async Task<ActionResult> ViewSubmissionHistory(Guid pcsId, SubmissionsHistoryOrderBy orderBy = SubmissionsHistoryOrderBy.ComplianceYearDescending, int page = 1) { await SetBreadcrumb(pcsId, "View submission history"); if (page < 1) { page = 1; } var model = new SubmissionHistoryViewModel(); model.OrderBy = orderBy; using (var client = apiClient()) { var scheme = await client.SendAsync(User.GetAccessToken(), new GetSchemePublicInfo(pcsId)); if (scheme != null) { var getSubmissionsHistoryResults = new GetSubmissionsHistoryResults(scheme.SchemeId, scheme.OrganisationId, ordering: orderBy); var results = await client.SendAsync(User.GetAccessToken(), getSubmissionsHistoryResults); if (results.Data != null) { model.Results = results.Data.ToPagedList(page - 1, DefaultPageSize, results.ResultCount); } } } return View(model); }
private async Task <ActionResult> RetrieveSubmissionResults(int year, Guid schemeId, SubmissionsHistoryOrderBy orderBy) { if (Request != null && !Request.IsAjaxRequest()) { throw new InvalidOperationException(); } if (!ModelState.IsValid) { return(Json(null, JsonRequestBehavior.AllowGet)); } using (var client = apiClient()) { try { var schemeData = await client.SendAsync(User.GetAccessToken(), new GetSchemeById(schemeId)); var request = new GetSubmissionsHistoryResults(schemeId, schemeData.OrganisationId, year, orderBy, true); var searchResults = await client.SendAsync(User.GetAccessToken(), request); var model = new SubmissionsResultsViewModel { Year = year, Scheme = schemeId, Results = searchResults.Data, OrderBy = orderBy }; return(PartialView("_submissionsResults", model)); } catch (ApiBadRequestException ex) { this.HandleBadRequest(ex); throw; } } }
public Task <ActionResult> GetSubmissionResults(int year, Guid schemeId, SubmissionsHistoryOrderBy orderBy) { return(RetrieveSubmissionResults(year, schemeId, orderBy)); }