using System.Collections.Generic;
using System.Threading.Tasks;
using GxPress.Common.Page;
using GxPress.Repository.Interface.SystemLabel;
using GxPress.Request.SystemLabel;
using GxPress.Result.SystemLabel;
using GxPress.Service.Interface.SystemLabel;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace GxPress.Api.AdminControllers
{
///
/// 系统标签管理
///
[Route("api/admin/system-label")]
[ApiController]
[Authorize]
public class AdminSystemLabelController : ControllerBase
{
private readonly ISystemLabelRepository _repository;
private readonly ISystemLableMediaRepository systemLableMediaRepository;
private readonly ISystemLabelService systemLabelService;
public AdminSystemLabelController(ISystemLabelRepository repository, ISystemLabelService systemLabelService, ISystemLableMediaRepository systemLableMediaRepository)
{
_repository = repository;
this.systemLabelService = systemLabelService;
this.systemLableMediaRepository = systemLableMediaRepository;
}
///
/// 添加
///
///
///
[HttpPost]
public async Task Insert(Entity.SystemLabel.SystemLabel note)
{
return await _repository.InsertAsync(note);
}
///
/// 修改
///
///
///
[HttpPut]
public async Task UpdateAsync(SystemLabelUpRequest request)
{
return await _repository.UpdateAsync(request);
}
///
/// 获取标签列表
///
///
[HttpGet("list")]
public async Task> GetAllAsync()
{
return await systemLabelService.GetAllAsync();
}
///
/// 获取标签列表
///
///
[HttpPost("list-page")]
public async Task> GetAllPageAsync(SystemLabelRequest request)
{
return await systemLabelService.GetAllPageAsync(request);
}
///
/// 删除
///
///
///
[HttpDelete("{id}")]
public async Task DeleteAsync(int id)
{
return await _repository.DeleteAsync(id);
}
///
/// 添加标签媒体
///
///
///
[HttpPost("add")]
public async Task InsertAsync(SystemLableMediaRequest request)
{
return await systemLableMediaRepository.InsertAsync(request);
}
///
/// 获取明栏分页
///
///
///
[HttpPost("star-page")]
public async Task> GetAllStarLablePageAsync(Common.Page.PageParameter request)
{
return await systemLabelService.GetAllStarLablePageAsync(request);
}
///
/// 获取明栏
///
///
[HttpPost("star-list")]
public async Task> GetStarLableAllAsync()
{
return await systemLabelService.GetStarLableAllAsync();
}
}
}