Exemplo n.º 1
0
        public async Task InsertAsync(int groupId, string title, string imageUrl, string summary, string body)
        {
            var article = new MaterialArticle
            {
                GroupId          = groupId,
                ThumbMediaId     = string.Empty,
                Author           = string.Empty,
                Title            = title,
                ContentSourceUrl = string.Empty,
                Content          = body,
                Digest           = summary,
                ShowCoverPic     = !string.IsNullOrEmpty(imageUrl),
                ThumbUrl         = imageUrl,
                CommentType      = CommentType.Block
            };

            var materialId = await _materialArticleRepository.InsertAsync(article);

            var messageId = await _repository.InsertAsync(
                new MaterialMessage
            {
                GroupId = groupId
            },
                Q.CachingRemove(CacheKey)
                );

            var item = new MaterialMessageItem
            {
                MessageId    = messageId,
                MaterialType = MaterialType.Article,
                MaterialId   = materialId,
                Taxis        = 1
            };
            await _materialMessageItemRepository.InsertAsync(item);
        }
 public async Task <int> InsertAsync(MaterialMessageItem item)
 {
     return(await _repository.InsertAsync(item, Q
                                          .CachingRemove(GetCacheKey(item.MessageId))
                                          ));
 }