using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Nirvana.Common;
using Nirvana.Common.ApiBase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using YBDevice.Api.DBServices;

namespace YBDevice.Api.Controllers
{
    /// <summary>
    /// 广告管理
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class AdController : ControllerBase
    {
        /// <summary>
        /// 科普资讯列表
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultInfo> GetInfoListAsync([FromBody] ParamQuery param)
        {
            var list = await new InfoApp().GetInfoListAsync(param);
            return new ResultInfo(ResultState.SUCCESS, "success", list);
        }
        /// <summary>
        /// 科普资讯详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ResultInfo> InfoDetailAsync(int id)
        {
            var data = await new InfoApp().InfoDetailAsync(id);
            return data;
        }

        /// <summary>
        /// 科普资讯标签列表
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<ResultInfo> GetInfoTagListAsync()
        {
            var data = await new InfoApp().GetInfoTagListAsync();
            return data;
        }
    }
}
