using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Blog.Core.Common;
using Blog.Core.IServices;
using Blog.Core.Model.Models;
using Blog.Core.Model.VeiwModels;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace Blog.Core.Controllers
{
///
/// Blog控制器所有接口
///
[Produces("application/json")]
[Route("api/Blog")]
//[Authorize(Roles = "Admin")]
//[Authorize(Policy = "Admin")]
public class BlogController : Controller
{
IAdvertisementServices advertisementServices;
IBlogArticleServices blogArticleServices;
IRedisCacheManager redisCacheManager;
///
/// 构造函数
///
///
///
///
public BlogController(IAdvertisementServices advertisementServices, IBlogArticleServices blogArticleServices, IRedisCacheManager redisCacheManager)
{
this.advertisementServices = advertisementServices;
this.blogArticleServices = blogArticleServices;
this.redisCacheManager = redisCacheManager;
}
///
/// 获取博客列表
///
///
[HttpGet]
[Route("GetBlogs")]
public async Task> GetBlogs()
{
//var connect=Appsettings.app(new string[] { "AppSettings", "RedisCaching" , "ConnectionString" });//按照层级的顺序,依次写出来
List blogArticleList = new List();
if (redisCacheManager.Get