public async Task <IActionResult> ConfirmTlevelAsyc(ConfirmTlevelViewModel viewModel) { if (viewModel == null || viewModel.PathwayStatusId != (int)TlevelReviewStatus.AwaitingConfirmation) { return(RedirectToRoute(RouteConstants.PageNotFound)); } if (!ModelState.IsValid) { var model = await GetVerifyTlevelData(viewModel.PathwayId); return(View("Verify", model)); } if (viewModel.IsEverythingCorrect == false) { TempData.Set(Constants.IsBackToVerifyPage, true); return(RedirectToRoute(RouteConstants.QueryTlevelDetails, new { id = viewModel.PathwayId })); } var isSuccess = await _tlevelLoader.ConfirmTlevelAsync(viewModel); if (isSuccess) { TempData["IsRedirect"] = true; return(RedirectToRoute(RouteConstants.TlevelDetailsConfirmed, new { id = viewModel.PathwayId })); } else { _logger.LogWarning(LogEvent.TlevelsNotConfirmed, $"Unable to confirm T level. Method: ConfirmTlevelAsync, Ukprn: {User.GetUkPrn()}, PathwayId: {viewModel.PathwayId}, User: {User.GetUserEmail()}"); return(RedirectToRoute(RouteConstants.Error, new { StatusCode = 500 })); } }
public override void Given() { InputModel = new ConfirmTlevelViewModel { PathwayStatusId = (int)TlevelReviewStatus.AwaitingConfirmation, PathwayId = pathwayId }; TlevelLoader.ConfirmTlevelAsync(InputModel).Returns(false); }
public override void Given() { pathwayId = 10; viewModel = new ConfirmTlevelViewModel { PathwayStatusId = (int)TlevelReviewStatus.Confirmed }; TlevelLoader.GetVerifyTlevelDetailsByPathwayIdAsync(ukprn, pathwayId) .Returns(viewModel); }
public override void Given() { pathwayId = 10; isBack = true; expectedModel = new ConfirmTlevelViewModel { PathwayStatusId = (int)TlevelReviewStatus.AwaitingConfirmation }; TlevelLoader.GetVerifyTlevelDetailsByPathwayIdAsync(ukprn, pathwayId) .Returns(expectedModel); }
public override void Given() { ExpectedResult = true; ConfirmTlevelViewModel = new ConfirmTlevelViewModel { PathwayId = PathwayId, TqAwardingOrganisationId = PathwayId }; VerifyTlevelDetails = new VerifyTlevelDetails { Id = PathwayId, TqAwardingOrganisationId = PathwayId, PathwayStatusId = StatusId }; Mapper.Map <VerifyTlevelDetails>(ConfirmTlevelViewModel).Returns(VerifyTlevelDetails); InternalApiClient.VerifyTlevelAsync(VerifyTlevelDetails).Returns(ExpectedResult); Loader = new TlevelLoader(InternalApiClient, Mapper); }
public override void Given() { pathwayId = 10; expectedModel = new ConfirmTlevelViewModel { TqAwardingOrganisationId = 1, RouteId = 2, PathwayId = pathwayId, PathwayStatusId = (int)TlevelReviewStatus.AwaitingConfirmation, IsEverythingCorrect = true, PathwayName = "Pathway 1", Specialisms = new List <string> { "sp1", "sp2" } }; TlevelLoader.GetVerifyTlevelDetailsByPathwayIdAsync(ukprn, pathwayId) .Returns(expectedModel); }
public override void Given() { expectedResult = new ConfirmTlevelViewModel { PathwayId = pathwayId, PathwayName = "PathName", RouteId = 5, IsEverythingCorrect = false, PathwayStatusId = 1, TqAwardingOrganisationId = 7, Specialisms = new List <string> { "spl1", "spl2" } }; InputModel = new ConfirmTlevelViewModel { PathwayStatusId = (int)TlevelReviewStatus.AwaitingConfirmation, PathwayId = pathwayId }; TlevelLoader.GetVerifyTlevelDetailsByPathwayIdAsync(ukprn, pathwayId) .Returns(expectedResult); Controller.ModelState.AddModelError("IsEverythingCorrect", "Select yes if this T Level’s details are correct"); }
public async Task <bool> ConfirmTlevelAsync(ConfirmTlevelViewModel viewModel) { var confirmModel = _mapper.Map <VerifyTlevelDetails>(viewModel); return(await _internalApiClient.VerifyTlevelAsync(confirmModel)); }
public override void Given() { InputModel = new ConfirmTlevelViewModel { PathwayStatusId = (int)TlevelReviewStatus.AwaitingConfirmation, PathwayId = pathwayId, IsEverythingCorrect = false }; }
public override void Given() { InputModel = new ConfirmTlevelViewModel { PathwayStatusId = (int)TlevelReviewStatus.Confirmed }; }