public IActionResult DeleteDeliveryOption(DeleteDeliveryOptionViewModel model)
        {
            var apprenticeship = _session.GetObject <Apprenticeship>("selectedApprenticeship");
            var Location       = apprenticeship?.ApprenticeshipLocations.FirstOrDefault(x => x.Id == model.Id);

            if (apprenticeship == null || Location == null)
            {
                return(RedirectToAction("Index", "ProviderApprenticeships", new { }));
            }
            apprenticeship.ApprenticeshipLocations.RemoveAll(x => x.Id == model.Id);

            _session.SetObject("selectedApprenticeship", apprenticeship);
            return(RedirectToAction(model.Combined ? "DeliveryOptionsCombined" : "DeliveryOptions", "Apprenticeships",
                                    new { message = "Location " + model.LocationName + " deleted" }));
        }
        public IActionResult DeleteDeliveryOption(string LocationName, ApprenticeshipMode Mode, Guid Id)
        {
            var apprenticeship = _session.GetObject <Apprenticeship>("selectedApprenticeship");
            var Location       = apprenticeship?.ApprenticeshipLocations.FirstOrDefault(x => x.Id == Id);

            if (apprenticeship == null || Location == null)
            {
                return(RedirectToAction("Index", "ProviderApprenticeships", new { }));
            }

            var model = new DeleteDeliveryOptionViewModel();

            model.Combined     = Location.ApprenticeshipLocationType == ApprenticeshipLocationType.ClassroomBasedAndEmployerBased;
            model.LocationName = LocationName;

            model.ApprenticeshipTitle = Location?.Name;

            return(View("../Apprenticeships/DeleteDeliveryOption/Index", model));
        }