public ActionResult DeleteMedia(Media model) { mediaManager.DeleteMedia(model.MediaID); MediaDisplay(); return(View("MediaDisplay")); }
public ActionResult DeleteMedia(Media model) { if ((int)Session["UserLevel"] == 3) { mediaManager.DeleteMedia(model.MediaID); } MediaDisplay(); return(View("MediaDisplay")); }
private void _deleteSelected(object o) { List <IMedia> selection = _getSelections(); if (MessageBox.Show(string.Format(resources._query_DeleteSelectedFiles, selection.AsString(Environment.NewLine)), resources._caption_Confirmation, MessageBoxButton.OKCancel) == MessageBoxResult.OK) { var reasons = _mediaManager.DeleteMedia(selection, false).Where(r => r.Reason != MediaDeleteDenyReason.MediaDeleteDenyReasonEnum.NoDeny); if (reasons.Any()) { StringBuilder reasonMsg = new StringBuilder(); foreach (var reason in reasons) { switch (reason.Reason) { case MediaDeleteDenyReason.MediaDeleteDenyReasonEnum.NoDeny: break; case MediaDeleteDenyReason.MediaDeleteDenyReasonEnum.MediaInFutureSchedule: reasonMsg.AppendLine().Append(reason.Media.MediaName).Append(": ").AppendFormat(resources._message_MediaDeleteDenyReason_Scheduled, reason.Event == null ? resources._unknown_ : reason.Event.EventName, reason.Event == null ? resources._unknown_ : reason.Event.ScheduledTime.ToLocalTime().ToString()); break; case MediaDeleteDenyReason.MediaDeleteDenyReasonEnum.Protected: reasonMsg.AppendLine().Append(reason.Media.MediaName).Append(": ").Append(resources._message_MediaDeleteDenyReason_Protected); break; default: reasonMsg.AppendLine().Append(reason.Media.MediaName).Append(": ").Append(resources._message_MediaDeleteDenyReason_Unknown); break; } } if (reasonMsg.Length > 0) { if (MessageBox.Show(String.Join(Environment.NewLine, resources._message_MediaDeleteNotAllowed, reasonMsg.ToString(), Environment.NewLine, resources._message_DeleteAnyway), resources._caption_Error, MessageBoxButton.YesNo, MessageBoxImage.Error) == MessageBoxResult.Yes) { _mediaManager.DeleteMedia(reasons.Select(r => r.Media), true); } } } } }