using learun.iapplication;
using learun.util;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
namespace EC.Web.Areas.LR_LGManager.Controllers
{
///
/// 版 本 EasyCode EC管理后台
/// Copyright (c) 2019-present EC管理有限公司
/// 创建人:tobin
/// 日 期:2019.10.22
/// 描 述:多语言语言映射控制器
///
[Area("LR_LGManager")]
public class LGMapController : MvcControllerBase
{
private readonly LGMapIBLL _lGMapIBLL;
public LGMapController(LGMapIBLL lGMapIBLL)
{
_lGMapIBLL = lGMapIBLL;
}
#region 视图功能
///
/// 主页面
///
///
[HttpGet]
public IActionResult Index()
{
return View();
}
///
/// 表单页
///
///
[HttpGet]
public IActionResult Form()
{
return View();
}
///
/// 数据字典语言
///
///
[HttpGet]
public IActionResult DataItemLG()
{
return View();
}
///
/// 系统功能语言
///
///
[HttpGet]
public IActionResult SystemModuleLG()
{
return View();
}
///
/// 新增
///
///
[HttpGet]
public IActionResult AddForm()
{
return View();
}
#endregion 视图功能
#region 获取数据
///
/// 获取列表数据
///
/// 语言类型编码
///
[HttpGet]
[AjaxOnly]
public async Task GetListByTypeCode(string TypeCode)
{
var data = await _lGMapIBLL.GetListByTypeCode(TypeCode);
return Success(data);
}
///
/// 获取列表分页数据
///
/// 分页参数
/// 查询参数
/// 语言类型列表
///
[HttpGet]
[AjaxOnly]
public async Task GetPageList(string pagination, string queryJson, string typeList)
{
Pagination paginationobj = pagination.ToObject();
var data = await _lGMapIBLL.GetPageList(paginationobj, queryJson, typeList);
var jsonData = new
{
rows = data,
paginationobj.total,
paginationobj.page,
paginationobj.records
};
return Success(jsonData);
}
///
/// 获取列表分页数据
///
/// 需要翻译的列表
/// 语言类型列表
///
[HttpGet]
[AjaxOnly]
public async Task GetList(string dataList, string typeList)
{
var data = await _lGMapIBLL.GetList(dataList, typeList);
return Success(data);
}
///
/// 获取表单数据
///
/// 主键
///
[HttpGet]
[AjaxOnly]
public async Task GetFormData(string keyValue)
{
var data = await _lGMapIBLL.GetEntity(keyValue);
return Success(data);
}
///
/// 根据名称获取列表
///
/// 名称
///
[HttpGet]
[AjaxOnly]
public async Task GetListByName(string name)
{
var data = await _lGMapIBLL.GetListByName(name);
return Success(data);
}
///
/// 根据名称与类型获取列表
///
/// 名称
/// 语言类型编码
///
[HttpGet]
[AjaxOnly]
public async Task GetListByNameAndType(string name, string typeCode)
{
var data = await _lGMapIBLL.GetListByNameAndType(name, typeCode);
return Success(data);
}
///
/// 根据语言类型编码获取语言包
///
/// 语言类型编码
/// 是否是主语言
///
[HttpGet]
[AjaxOnly]
public async Task GetLanguageByCode(string typeCode, bool isMain)
{
var data = await _lGMapIBLL.GetMap(typeCode, isMain);
return Success(data);
}
#endregion 获取数据
#region 提交数据
///
/// 删除实体数据
///
/// 一组语言编码
///
[HttpPost]
[AjaxOnly]
public async Task DeleteForm(string code)
{
await _lGMapIBLL.DeleteEntity(code);
return SuccessInfo("删除成功!");
}
///
/// 保存实体数据(新增、修改)
///
/// 原列表
/// 新列表
/// 一组语言编码
///
[HttpPost]
[AjaxOnly]
public async Task SaveForm(string nameList, string newNameList, string code)
{
await _lGMapIBLL.SaveEntity(nameList, newNameList, code);
return SuccessInfo("保存成功!");
}
#endregion 提交数据
}
}