public async Task <ActionResult> DeleteCohort(DeleteCommitmentViewModel viewModel) { if (!ModelState.IsValid) { var model = await _commitmentOrchestrator.GetDeleteCommitmentModel(viewModel.ProviderId, viewModel.HashedCommitmentId); return(View(model)); } if (viewModel.DeleteConfirmed == null || !viewModel.DeleteConfirmed.Value) { return(RedirectToAction("Details", new { providerId = viewModel.ProviderId, hashedCommitmentId = viewModel.HashedCommitmentId })); } await _commitmentOrchestrator.DeleteCommitment(CurrentUserId, viewModel.ProviderId, viewModel.HashedCommitmentId, GetSignedInUser()); return(Redirect(_providerUrlhelper.ProviderCommitmentsLink($"{viewModel.ProviderId}/unapproved"))); }
public async Task <ActionResult> DeleteCohort(DeleteCommitmentViewModel viewModel) { if (!ModelState.IsValid) { var model = await _employerCommitmentsOrchestrator .GetDeleteCommitmentModel(viewModel.HashedAccountId, viewModel.HashedCommitmentId, OwinWrapper.GetClaimValue(@"sub")); return(View(model)); } if (viewModel.DeleteConfirmed == null || !viewModel.DeleteConfirmed.Value) { return(RedirectToAction("Details", new { viewModel.HashedAccountId, viewModel.HashedCommitmentId })); } await _employerCommitmentsOrchestrator .DeleteCommitment(viewModel.HashedAccountId, viewModel.HashedCommitmentId, OwinWrapper.GetClaimValue("sub"), OwinWrapper.GetClaimValue(DasClaimTypes.DisplayName), OwinWrapper.GetClaimValue(DasClaimTypes.Email)); var flashmessage = new FlashMessageViewModel { Message = "Cohort deleted", Severity = FlashMessageSeverityLevel.Okay }; AddFlashMessageToCookie(flashmessage); var anyCohortWithCurrentStatus = await _employerCommitmentsOrchestrator.AnyCohortsForCurrentStatus(viewModel.HashedAccountId, GetSessionRequestStatus()); if (!anyCohortWithCurrentStatus) { return(RedirectToAction("YourCohorts", new { viewModel.HashedAccountId })); } return(Redirect(GetReturnToListUrl(viewModel.HashedAccountId))); }