Esempio n. 1
0
        public JsonResult AddAttention(OauthToken token, long attentionUserKeyId)
        {
            var model = new ArticleAttentionDataContract();
            model.UserKeyId = token.UserKeyId;
            model.AttentionUserKeyId = attentionUserKeyId;
            model.AttentionTime = DateTime.Now;

            return Json(articleAttentionService.AddArticleAttention(model));
        }
Esempio n. 2
0
        public ReturnResult<bool> AddArticleAttention(ArticleAttentionDataContract articleAttention)
        {
            if (articleAttention.AttentionUserKeyId == articleAttention.UserKeyId)
            {
                return new ReturnResult<bool>(101, false, "不允许关注自己");
            }
            if (ArticleAttentionRepository.Instance.IsExists(articleAttention.UserKeyId, articleAttention.AttentionUserKeyId))
            {
                return new ReturnResult<bool>(true);
            }

            return new ReturnResult<bool>(ArticleAttentionRepository.Instance.InsertArticleAttention(articleAttention));
        }