110,499
社区成员
发帖
与我相关
我的任务
分享
$("#btnSave").click(function () {
var title = $('#Titles').val();
var content = $('#Contents').val();
var date = new Date();
/*提交发帖保存数据*/
$.ajax({
url: "/Admin/ThemeDraft",
type: "POST",
data: { "title": title, "content": content },
success: function (data) {
alert(data);
if (data == "Success") {
$("#msg").show();
$("#msg").html(date.toLocaleTimeString() + "成功保存到草稿箱");
setTimeout(function () {
$("#msg").hide();
}, 8000);
} else {
$("#msg").show();
$("#msg").val("保存失败");
setTimeout(function(){$("#msg").hide(),5000});
}
}
});
});
TDraft tdrat = new TDraft()
{
Title = title,
Contents = content,
SaveTime = DateTime.Now,
MemberName = AdminManage.GetLoginMemberName(),
MemberID = AdminManage.GetLoginMemberID(),
Status = false,
};
try
{
Drafts dratfs = new Drafts();
dratfs.AddDratf(tdrat);
return "Success";
}
catch (Exception ex)
{
_log.LogError("ThemeDraft Exception:" + ex.Message);
return ex.Message;
}
[HttpPost]
[Authorize]
public String ThemeDraft(String title, String content)
{
TDraft tdrat = new TDraft()
{
Title = title,
Contents = content,
SaveTime = DateTime.Now,
MemberName = AdminManage.GetLoginMemberName(),
MemberID = AdminManage.GetLoginMemberID(),
Status = false,
};
try
{
Drafts dratfs = new Drafts();
dratfs.AddDratf(tdrat);
return "Success";
}
catch (Exception ex)
{
_log.LogError("ThemeDraft Exception:" + ex.Message);
return ex.Message;
}
}