using Learun.Application.Base.SystemModule;
using System.Web.Mvc;
namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers
{
///
/// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
/// Copyright (c) 2013-2018 北京泉江科技有限公司
/// 创建人:陈彬彬
/// 日 期:2017.04.01
/// 描 述:行政区域
///
public class AreaController : MvcControllerBase
{
private AreaIBLL areaIBLL = new AreaBLL();
#region 视图功能
///
/// 行政区域管理
///
///
[HttpGet]
public ActionResult Index()
{
return View();
}
///
/// 表单
///
///
[HttpGet]
public ActionResult Form()
{
return View();
}
#endregion
#region 获取数据
///
/// 获取列表数据
///
/// 父级主键
/// 关键字查询(名称/编号)
///
[HttpGet]
[AjaxOnly]
public ActionResult Getlist(string parentId, string keyword)
{
var data = areaIBLL.GetList(parentId, keyword);
return JsonResult(data);
}
///
/// 获取树形数据
///
///
///
[HttpGet]
[AjaxOnly]
public ActionResult GetTree(string parentId)
{
var data = areaIBLL.GetTree(parentId);
return JsonResult(data);
}
#endregion
#region 提交数据
///
/// 保存表单数据
///
///
///
///
[HttpPost]
[ValidateAntiForgeryToken]
[AjaxOnly]
public ActionResult SaveForm(string keyValue, AreaEntity entity)
{
var model = areaIBLL.GetEntityByCode(entity.F_AreaCode);
if (string.IsNullOrEmpty(keyValue))
{
if (model.F_AreaCode == entity.F_AreaCode)
{
return Fail("编号重复,新重新输入!");
}
}
else
{
if (model.F_AreaCode == entity.F_AreaCode && model.F_AreaId != keyValue)
{
return Fail("编号重复,新重新输入!");
}
}
areaIBLL.SaveEntity(keyValue, entity);
return Success("保存成功!");
}
///
/// 删除表单数据
///
///
///
[HttpPost]
[AjaxOnly]
public ActionResult DeleteForm(string keyValue)
{
areaIBLL.VirtualDelete(keyValue);
return Success("删除成功!");
}
#endregion
}
}