using learun.iapplication; using Microsoft.AspNetCore.Mvc; using System.Threading.Tasks; namespace EC.Web.Areas.LR_SystemModule.Controllers { /// /// 版 本 EasyCode EC管理后台 /// Copyright (c) 2019-present EC管理有限公司 /// 创建人:tobin /// 日 期:2019.09.18 /// 描 述:行政区域 /// [Area("LR_SystemModule")] public class AreaController : MvcControllerBase { private readonly AreaIBLL _areaIBLL; public AreaController(AreaIBLL areaIBLL) { _areaIBLL = areaIBLL; } #region 视图功能 /// /// 主页面 /// /// [HttpGet] public IActionResult Index() { return View(); } /// /// 表单页 /// /// [HttpGet] public IActionResult Form() { return View(); } #endregion 视图功能 #region 获取数据 /// /// 获取列表数据 /// /// 父级主键 /// 关键字查询(名称/编号) /// [HttpGet] [AjaxOnly] public async Task Getlist(string parentId, string keyword) { var list = await _areaIBLL.GetList(parentId, keyword); return Success(list); } /// /// 获取树形数据 /// /// /// [HttpGet] [AjaxOnly] public async Task GetTree(string parentId = "0") { var data = await _areaIBLL.GetTree(parentId); return Success(data); } #endregion 获取数据 #region 提交数据 /// /// 保存表单数据 /// /// /// /// [HttpPost] [AjaxOnly] public async Task SaveForm(string keyValue, AreaEntity entity) { await _areaIBLL.SaveEntity(keyValue, entity); return SuccessInfo("保存成功!"); } /// /// 删除表单数据 /// /// /// [HttpPost] [AjaxOnly] public async Task DeleteForm(string keyValue) { await _areaIBLL.Delete(keyValue); return SuccessInfo("删除成功!"); } #endregion 提交数据 } }