using Learun.Application.OA;
using Learun.Util;
using System.Web.Mvc;
namespace Learun.Application.Web.Areas.LR_OAModule.Controllers
{
///
/// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
/// Copyright (c) 2013-2018 北京泉江科技有限公司
/// 创建人:陈彬彬
/// 日 期:2017.04.01
/// 描 述:新闻管理
///
public class NewsController : MvcControllerBase
{
private NewsIBLL newsIBLL = new NewsBLL();
#region 视图功能
///
/// 管理页面
///
///
[HttpGet]
public ActionResult Index()
{
return View();
}
///
/// 表单页面
///
///
[HttpGet]
public ActionResult Form()
{
return View();
}
#endregion
#region 获取数据
///
/// 获取分页数据
///
/// 分页参数
/// 类型
/// 关键词
///
public ActionResult GetPageList(string pagination, string keyword)
{
Pagination paginationobj = pagination.ToObject();
var data = newsIBLL.GetPageList(paginationobj, keyword);
var jsonData = new
{
rows = data,
total = paginationobj.total,
page = paginationobj.page,
records = paginationobj.records,
};
return JsonResult(jsonData);
}
///
/// 获取实体数据
///
/// 主键
///
public ActionResult GetEntity(string keyValue)
{
var data = newsIBLL.GetEntity(keyValue);
data.F_NewsContent = WebHelper.HtmlDecode(data.F_NewsContent);
return JsonResult(data);
}
#endregion
#region 提交数据
///
/// 保存表单数据
///
/// 主键
/// 实体
///
[HttpPost, ValidateAntiForgeryToken, AjaxOnly, ValidateInput(false)]
public ActionResult SaveForm(string keyValue, NewsEntity entity)
{
entity.F_NewsContent = WebHelper.HtmlEncode(entity.F_NewsContent);
newsIBLL.SaveEntity(keyValue, entity);
return Success("保存成功!");
}
///
/// 删除表单数据
///
/// 主键
///
[HttpPost]
[AjaxOnly]
public ActionResult DeleteForm(string keyValue)
{
newsIBLL.DeleteEntity(keyValue);
return Success("删除成功!");
}
#endregion
}
}