using learun.iapplication;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
namespace EC.Web.Areas.LR_OrganizationModule.Controllers
{
///
/// 版 本 EasyCode EC管理后台
/// Copyright (c) 2019-present EC管理有限公司
/// 创建人:tobin
/// 日 期:2019.09.27
/// 描 述:岗位模块控制器
///
[Area("LR_OrganizationModule")]
public class PostController : MvcControllerBase
{
private readonly PostIBLL _postIBLL;
public PostController(PostIBLL postIBLL)
{
_postIBLL = postIBLL;
}
#region 获取视图
///
/// 主页
///
///
[HttpGet]
public IActionResult Index()
{
return View();
}
///
/// 表单
///
///
[HttpGet]
public IActionResult Form()
{
return View();
}
///
/// 岗位选择页面
///
///
[HttpGet]
public IActionResult SelectForm()
{
return View();
}
#endregion 获取视图
#region 获取数据
///
/// 获取岗位列表信息
///
/// 公司
/// 部门
/// 查询关键字
///
[HttpGet]
[AjaxOnly]
public async Task GetList(string companyId, string departmentId, string keyword)
{
var data = await _postIBLL.GetList(companyId, departmentId, keyword);
return Success(data);
}
///
/// 获取树形数据
///
/// 公司主键
///
[HttpGet]
[AjaxOnly]
public async Task GetTree(string companyId)
{
var data = await _postIBLL.GetTree(companyId);
return Success(data);
}
///
/// 获取岗位名称
///
/// 岗位主键
///
[HttpGet]
[AjaxOnly]
public async Task GetEntityName(string keyValue)
{
if (keyValue == "0")
{
return Success("");
}
var data = await _postIBLL.GetEntity(keyValue);
return Success(data.F_Name);
}
///
/// 获取岗位实体数据
///
/// 岗位主键
///
[HttpGet]
[AjaxOnly]
public async Task GetEntity(string keyValue)
{
var data = await _postIBLL.GetEntity(keyValue);
return Success(data);
}
#endregion 获取数据
#region 提交数据
///
/// 保存表单数据
///
/// 主键
/// 实体
///
[HttpPost]
[AjaxOnly]
public async Task SaveForm(string keyValue, PostEntity entity)
{
await _postIBLL.SaveEntity(keyValue, entity);
return SuccessInfo("保存成功!");
}
///
/// 删除表单数据
///
/// 主键
///
[HttpPost]
[AjaxOnly]
public async Task DeleteForm(string keyValue)
{
await _postIBLL.Delete(keyValue);
return SuccessInfo("删除成功!");
}
#endregion 提交数据
}
}