Пример #1
0
        public async Task <IActionResult> UpdateSiteInfo()
        {
            SiteInfo info = _siteInfoManager.GetAllEntities().FirstOrDefault();

            if (info == null)
            {
                info = new SiteInfo();
            }
            info.ArticleCount = _articleManager.GetAllEntities().Count();
            info.TagCount     = _tagManager.GetAllEntities().Count();
            info.CommentCount = _commentManager.GetAllEntities().Count();
            info.ColumnCount  = (await _categoryManager.GetAllEntities().ToListAsync()).Count;//死数据,后期改
            info.Views++;
            var result = _siteInfoManager.EditEntity(info);

            if (result)
            {
                return(Ok(new { code = 0, count = 1, msg = "成功", data = info }));
            }
            return(Ok(new { code = 1, count = 0, msg = "失败", data = string.Empty }));
        }