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 _dictionaryServices;
        public DictionaryController(IDictionaryService dictionaryServices)
        {
            _dictionaryServices = dictionaryServices;
        }
        /// 
        /// 查询单条数据字典
        /// 
        /// 
        /// 
        [HttpGet]
        public async Task Get(long id)
        {
            return await _dictionaryServices.GetAsync(id);
        }
        /// 
        /// 查询分页数据字典
        /// 
        /// 
        /// 
        [HttpPost]
        public async Task GetPage(PageInput model)
        {
            return await _dictionaryServices.PageAsync(model);
        }
        /// 
        /// 新增数据字典
        /// 
        /// 
        /// 
        [HttpPost]
        public async Task Add(DictionaryAddInput input)
        {
            return await _dictionaryServices.AddAsync(input);
        }
        /// 
        /// 修改数据字典
        /// 
        /// 
        /// 
        [HttpPut]
        public async Task Update(DictionaryUpdateInput input)
        {
            return await _dictionaryServices.UpdateAsync(input);
        }
        /// 
        /// 删除数据字典
        /// 
        /// 
        /// 
        [HttpDelete]
        public async Task SoftDelete(long id)
        {
            return await _dictionaryServices.SoftDeleteAsync(id);
        }
    }
}