using Admin.Core.Common.Input;
using Admin.Core.Common.Output;
using Admin.Core.Model.Admin;
using Admin.Core.Service.Admin.Dictionary;
using Admin.Core.Service.Admin.Dictionary.Input;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
namespace Admin.Core.Controllers.Admin
{
///
/// 数据字典
///
public class DictionaryController : AreaController
{
private readonly IDictionaryService _dictionaryService;
public DictionaryController(IDictionaryService dictionaryService)
{
_dictionaryService = dictionaryService;
}
///
/// 查询单条数据字典
///
///
///
[HttpGet]
public async Task Get(long id)
{
return await _dictionaryService.GetAsync(id);
}
///
/// 查询分页数据字典
///
///
///
[HttpPost]
public async Task GetPage(PageInput model)
{
return await _dictionaryService.PageAsync(model);
}
///
/// 新增数据字典
///
///
///
[HttpPost]
public async Task Add(DictionaryAddInput input)
{
return await _dictionaryService.AddAsync(input);
}
///
/// 修改数据字典
///
///
///
[HttpPut]
public async Task Update(DictionaryUpdateInput input)
{
return await _dictionaryService.UpdateAsync(input);
}
///
/// 删除数据字典
///
///
///
[HttpDelete]
public async Task SoftDelete(long id)
{
return await _dictionaryService.SoftDeleteAsync(id);
}
///
/// 批量删除数据字典
///
///
///
[HttpPut]
public async Task BatchSoftDelete(long[] ids)
{
return await _dictionaryService.BatchSoftDeleteAsync(ids);
}
}
}