コード例 #1
0
        public async Task <ContentDto> UpdateContent(UpdateContentInput input)
        {
            var content = await _contentManager.ContentRepository.GetAsync(input.Id);

            var app = await _appManager.GetByIdAsync(content.AppId);

            content.Title        = input.Title;
            content.ContentText  = input.ContentText;
            content.Author       = input.Author;
            content.CheckedLevel = input.CheckedLevel;
            content.Comments     = input.Comments;
            content.ContentGroupNameCollection = input.ContentGroupNameCollection;
            content.FileUrl     = PageUtils.GetUrlWithoutAppDir(app, input.FileUrl);
            content.Hits        = input.Hits;
            content.HitsByDay   = input.HitsByDay;
            content.HitsByMonth = input.HitsByMonth;
            content.HitsByWeek  = input.HitsByWeek;
            content.ImageUrl    = PageUtils.GetUrlWithoutAppDir(app, input.ImageUrl);
            content.IsChecked   = input.IsChecked;
            content.IsColor     = input.IsColor;
            content.IsHot       = input.IsHot;
            content.IsRecommend = input.IsRecommend;
            content.IsTop       = input.IsTop;
            content.VideoUrl    = PageUtils.GetUrlWithoutAppDir(app, input.VideoUrl);

            await _contentManager.UpdateAsync(content);

            await CurrentUnitOfWork.SaveChangesAsync();

            return(content.MapTo <ContentDto>());
        }
コード例 #2
0
        public async Task <Content> UpdateContent(
            [Service] IAsyncUpdateStrategy <Content, UpdateContentInput> strategy,
            UpdateContentInput content
            )
        {
            var result = await strategy.UpdateAsync(content);

            return(result);
        }
コード例 #3
0
        public virtual async Task <CommentDto> UpdateContentAsync(UpdateContentInput input)
        {
            var comment = await GetEntityByIdAsync(input.Id);

            if (comment.CreatorId != CurrentUser.GetId())
            {
                throw new BusinessException(EasyCommentErrorCodes.OnlyOwnedCommentEditAllowed);
            }

            comment.SetContent(input.Content);
            return(MapToGetOutputDto(comment));
        }
コード例 #4
0
        public async Task <ContentDto> UpdateContent(UpdateContentInput input)
        {
            var content = await _contentManager.ContentRepository.GetAsync(input.Id);

            content.Title       = input.Title;
            content.ContentText = input.ContentText;

            await _contentManager.UpdateAsync(content);

            await CurrentUnitOfWork.SaveChangesAsync();

            return(content.MapTo <ContentDto>());
        }
コード例 #5
0
 public Task <CommentDto> UpdateContentAsync(UpdateContentInput input)
 {
     return(_service.UpdateContentAsync(input));
 }