public async Task <IActionResult> ConfirmationDelete(ConfirmationDeleteViewModel theModel) { _session.Remove("selectedApprenticeship"); switch (theModel.ApprenticeshipDelete) { case ApprenticeshipDelete.Delete: //call delete service var getApprenticehipByIdResult = await _apprenticeshipService.GetApprenticeshipByIdAsync(theModel.ApprenticeshipId.ToString()); if (getApprenticehipByIdResult.IsSuccess) { getApprenticehipByIdResult.Value.RecordStatus = RecordStatus.Deleted; var updateApprenticeshipResult = await _apprenticeshipService.UpdateApprenticeshipAsync(getApprenticehipByIdResult.Value); if (updateApprenticeshipResult.IsSuccess) { return(RedirectToAction("DeleteConfirm", "Apprenticeships", new { ApprenticeshipId = theModel.ApprenticeshipId, ApprenticeshipTitle = theModel.ApprenticeshipTitle })); } } return(RedirectToAction("Index", "ProviderApprenticeships")); case ApprenticeshipDelete.Back: return(RedirectToAction("Index", "ProviderApprenticeships")); default: return(RedirectToAction("Index", "Home")); } }
public IActionResult ConfirmationDelete(Guid ApprenticeshipId, string ApprenticeshipTitle, int level) { var model = new ConfirmationDeleteViewModel(); model.ApprenticeshipId = ApprenticeshipId; model.ApprenticeshipTitle = ApprenticeshipTitle; model.Level = level; return(View("../Apprenticeships/ConfirmApprenticeshipDelete/Index", model)); }