public async Task <IActionResult> ProgramImagesDelete(ProgramImagesViewModel model) { var settings = await _performerSchedulingService.GetSettingsAsync(); var schedulingStage = _performerSchedulingService.GetSchedulingStage(settings); if (schedulingStage != PsSchedulingStage.RegistrationOpen) { return(RedirectToAction(nameof(Index))); } var userId = GetId(ClaimType.UserId); var performer = await _performerSchedulingService.GetPerformerByUserIdAsync(userId); if (performer?.RegistrationCompleted != true) { return(RedirectToAction(nameof(Information))); } var program = await _performerSchedulingService.GetProgramByIdAsync(model.ProgramId); if (program == null) { return(RedirectToAction(nameof(Dashboard))); } var imageIds = Newtonsoft.Json.JsonConvert .DeserializeObject <List <int> >(model.ImagesToDelete); if (imageIds.Count > 0) { foreach (var imageId in imageIds) { await _performerSchedulingService.RemoveProgramImageByIdAsync(imageId); } ShowAlertSuccess("Image(s) deleted!"); } return(RedirectToAction(nameof(ProgramImages), new { id = program.Id })); }