/// <summary> /// Handles delete button action - deletes user favorite. /// </summary> protected void btnDelete_OnCommand(object sender, CommandEventArgs e) { // Check permissions if (!IsAvailable(ForumContext.CurrentForum, ForumActionType.Attachment)) { ShowError(GetString("ForumNewPost.PermissionDenied")); return; } if (e.CommandName == "delete") { int attachmentId = ValidationHelper.GetInteger(e.CommandArgument, 0); // Get forum attachment info ForumAttachmentInfo fai = ForumAttachmentInfoProvider.GetForumAttachmentInfo(attachmentId); if (fai != null) { // Delete attachment ForumAttachmentInfoProvider.DeleteForumAttachmentInfo(fai); } //Reload page URLHelper.Redirect(RequestContext.CurrentURL); } }
/// <summary> /// Unigrid Action event handler. /// </summary> private void UniGrid_OnAction(string actionName, object actionArgument) { if (actionName == "delete") { if (!CheckPermissions("cms.forums", PERMISSION_MODIFY)) { return; } ForumAttachmentInfoProvider.DeleteForumAttachmentInfo(ValidationHelper.GetInteger(actionArgument, 0)); } }