📄 deleteblogpostcommand.cs
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
// Copyright (c) Telligent Systems Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System;
using CommunityServer.Blogs.Components;
using CommunityServer.Components;
namespace CommunityServer.ControlPanel.Blogs
{
/// <summary>
/// Summary description for DeleteBlogPostCommand.
/// </summary>
public class DeleteBlogPostCommand : BlogCommand
{
public DeleteBlogPostCommand()
{
//
// TODO: Add constructor logic here
//
}
public override string Message(BlogCommandPage page)
{
int postid = CSContext.Current.PostID;
if(postid > 0)
{
WeblogPost wp = WeblogPosts.GetPost(postid,false,false,true);
if(wp != null)
{
return "Are you sure you want to delete <strong>" + wp.Subject + "</strong>? This action can not be undone.";
}
}
throw new Exception("The post could not be found");
}
public override void Action(BlogCommandPage page)
{
CSContext cntx = CSContext.Current;
int postid = cntx.PostID;
if(postid > 0)
{
WeblogPost wp = WeblogPosts.GetPost(postid,false,false,true);
if(wp != null)
{
WeblogPosts.Delete(wp,cntx.User.UserID);
return;
}
}
throw new Exception("The post could not be found");
}
public override string Title
{
get
{
return "Delete Post";
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -