using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using XYY.Common.Standard;
using XYY.Core.Standard.Mvc;
using XYY.Model.Standard.Channel;
using XYY.Service.Standard.Channel;
namespace XYY.Api.Channel.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ChannelController : ApiControllerBase
    {
        IChannelService _channelService;
        public ChannelController(IChannelService channelService)
        {
            _channelService = channelService;
        } 
        [HttpPost]
        [HttpGet]
        public async Task<IActionResult> QueryDtos(QueryModel queryModel)
        {
            return Ok(await _channelService.GetDtos(queryModel));
        }

        [HttpPost]
        public async Task<IActionResult> AddDto(Logistics_PublicChannelCategoryDto dto)
        {
            await _channelService.AddPublicChannelsAsDto(dto);
            return Ok();
        }

        [HttpPost]
        public async Task<IActionResult> EditDto(Logistics_PublicChannelCategoryDto dto)
        {
            await _channelService.EditPublicChannelsAsDto(dto);
            return Ok();
        }

        //public async Task<IActionResult> Test()
        //{
        //    var channels = await _channelService.CacheGetAllChannel();
        //    var publics = await _channelService.CacheGetAllPublic();
        //    return Ok();
        //}
    }
}
