public async Task <IActionResult> ImagesDelete(PerformerImagesViewModel 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 imageIds = Newtonsoft.Json.JsonConvert .DeserializeObject <List <int> >(model.ImagesToDelete); if (imageIds.Count > 0) { foreach (var imageId in imageIds) { await _performerSchedulingService.RemovePerformerImageByIdAsync(imageId); } ShowAlertSuccess("Image(s) deleted!"); } return(RedirectToAction(nameof(Images))); }