using learun.iapplication;
using learun.util;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
// For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace EC.Web.Areas.LR_IM.Controllers
{
///
/// 版 本 EasyCode EC管理后台
/// Copyright (c) 2019-present EC管理有限公司
/// 创建人:tobin
/// 日 期:2019.11.07
/// 描 述:即时通讯系统用户注册
///
[Area("LR_IM")]
public class SysUserController : MvcControllerBase
{
private readonly IMSysUserIBLL _iMSysUserIBLL;
public SysUserController(IMSysUserIBLL iMSysUserIBLL)
{
_iMSysUserIBLL = iMSysUserIBLL;
}
#region 视图功能
///
/// 主页面
///
///
[HttpGet]
public IActionResult Index()
{
return View();
}
///
/// 表单页
///
///
[HttpGet]
public IActionResult Form()
{
return View();
}
#endregion 视图功能
#region 获取数据
///
/// 获取列表数据
///
///
[HttpGet]
[AjaxOnly]
public async Task GetList(string queryJson)
{
var data = await _iMSysUserIBLL.GetList(queryJson);
return Success(data);
}
///
/// 获取列表分页数据
///
/// 分页参数
///
[HttpGet]
[AjaxOnly]
public async Task GetPageList(string pagination, string keyWord)
{
Pagination paginationobj = pagination.ToObject();
var data = await _iMSysUserIBLL.GetPageList(paginationobj, keyWord);
var jsonData = new
{
rows = data,
paginationobj.total,
paginationobj.page,
paginationobj.records
};
return Success(jsonData);
}
///
/// 获取表单数据
///
/// 主键
///
[HttpGet]
[AjaxOnly]
public async Task GetFormData(string keyValue)
{
var data = await _iMSysUserIBLL.GetEntity(keyValue);
return Success(data);
}
#endregion 获取数据
#region 提交数据
///
/// 删除实体数据
///
/// 主键
///
[HttpPost]
[AjaxOnly]
public async Task DeleteForm(string keyValue)
{
await _iMSysUserIBLL.DeleteEntity(keyValue);
return SuccessInfo("删除成功!");
}
///
/// 保存实体数据(新增、修改)
///
/// 主键
///
[HttpPost]
[AjaxOnly]
public async Task SaveForm(string keyValue, IMSysUserEntity entity)
{
await _iMSysUserIBLL.SaveEntity(keyValue, entity);
return SuccessInfo("保存成功!");
}
#endregion 提交数据
}
}