using System.Collections.Generic;
using System.Threading.Tasks;
using GxPress.Repository.Interface.SystemLabel;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace GxPress.Api.AdminControllers
{
    /// <summary>
    /// 系统标签管理
    /// </summary>
    [Route("api/admin/system-label")]
    [ApiController]
    [Authorize]
    public class AdminSystemLabelController : ControllerBase
    {
        private readonly ISystemLabelRepository _repository;

        public AdminSystemLabelController(ISystemLabelRepository repository)
        {
            _repository = repository;
        }
        [HttpPost]
        public async Task<int> Insert(Entity.SystemLabel.SystemLabel note)
        {
            return await _repository.InsertAsync(note);
        }
        [HttpPut]
        public async Task<bool> UpdateAsync(Entity.SystemLabel.SystemLabel note)
        {
            return await _repository.UpdateAsync(note);
        }
        [HttpGet]
        public async Task<IEnumerable<Entity.SystemLabel.SystemLabel>> GetAllAsync()
        {
            return await _repository.GetAllAsync();
        }
    }
}