public async Task <IActionResult> RemoveCoreAssessmentEntryAsync(AssessmentEntryDetailsViewModel model) { if (!ModelState.IsValid) { return(View(model)); } if (!model.CanRemoveAssessmentEntry.Value) { return(RedirectToRoute(RouteConstants.AssessmentDetails, new { model.ProfileId })); } model.ComponentType = ComponentType.Core; var isSuccess = await _assessmentLoader.RemoveAssessmentEntryAsync(User.GetUkPrn(), model); if (!isSuccess) { _logger.LogWarning(LogEvent.AddCoreAssessmentEntryFailed, $"Unable to remove core assessment for ProfileId: {model.ProfileId} and AssessmentId: {model.AssessmentId}. Method: RemoveAssessmentEntryAsync, Ukprn: {User.GetUkPrn()}, User: {User.GetUserEmail()}"); return(RedirectToRoute(RouteConstants.Error, new { StatusCode = 500 })); } await _cacheService.SetAsync(string.Concat(CacheKey, Constants.RemoveAssessmentEntryConfirmationViewModel), new RemoveAssessmentEntryConfirmationViewModel { ProfileId = model.ProfileId, Uln = model.Uln }, CacheExpiryTime.XSmall); return(RedirectToRoute(RouteConstants.AssessmentEntryRemovedConfirmation)); }
public override void Given() { ViewModel = new AssessmentEntryDetailsViewModel { ProfileId = ProfileId, AssessmentId = 5, AssessmentSeriesName = "Summer 2021", CanRemoveAssessmentEntry = false }; }
public override void Given() { mockresult = new AssessmentEntryDetailsViewModel { ProfileId = 1, AssessmentId = 5, AssessmentSeriesName = "Summer 2021" }; AssessmentLoader.GetActiveAssessmentEntryDetailsAsync(AoUkprn, ProfileId, ComponentType.Core).Returns(mockresult); }
public override void Given() { ViewModel = new AssessmentEntryDetailsViewModel { ProfileId = ProfileId, AssessmentId = 5, AssessmentSeriesName = "Summer 2021", CanRemoveAssessmentEntry = null }; Controller.ModelState.AddModelError(nameof(AssessmentEntryDetailsViewModel.CanRemoveAssessmentEntry), AssessmentContent.RemoveCoreAssessmentEntry.Select_RemoveCoreAssessment_Validation_Message); }
public override void Given() { ViewModel = new AssessmentEntryDetailsViewModel { ProfileId = ProfileId, AssessmentId = 5, ComponentType = Common.Enum.ComponentType.Core, CanRemoveAssessmentEntry = true }; AssessmentLoader.RemoveAssessmentEntryAsync(AoUkprn, ViewModel).Returns(false); }
public override void Given() { ViewModel = new AssessmentEntryDetailsViewModel { ProfileId = 1, Uln = 12345678, AssessmentId = 5, ComponentType = ComponentType.Core, CanRemoveAssessmentEntry = true }; _response = true; AssessmentLoader.RemoveAssessmentEntryAsync(AoUkprn, ViewModel).Returns(_response); }
public override void Given() { ViewModel = new AssessmentEntryDetailsViewModel { ProfileId = ProfileId, AssessmentId = 1, ComponentType = Common.Enum.ComponentType.Core, }; ExpectedApiResult = true; InternalApiClient .RemoveAssessmentEntryAsync(Arg.Is <RemoveAssessmentEntryRequest>( x => x.AssessmentId == ViewModel.AssessmentId && x.AoUkprn == AoUkprn && x.ComponentType == Common.Enum.ComponentType.Core)) .Returns(ExpectedApiResult); }
public async override Task When() { ActualResult = await Loader.GetActiveAssessmentEntryDetailsAsync(AoUkprn, ProfileId, componentType); }
public async Task <bool> RemoveAssessmentEntryAsync(long aoUkprn, AssessmentEntryDetailsViewModel viewModel) { var request = _mapper.Map <RemoveAssessmentEntryRequest>(viewModel, opt => opt.Items["aoUkprn"] = aoUkprn); return(await _internalApiClient.RemoveAssessmentEntryAsync(request)); }