示例#1
0
        public virtual async Task <BlogPostDto> UpdateAsync(Guid id, UpdateBlogPostDto input)
        {
            var blogPost = await BlogPostRepository.GetAsync(id);

            blogPost.SetTitle(input.Title);
            blogPost.SetShortDescription(input.ShortDescription);

            if (blogPost.Slug != input.Slug)
            {
                await BlogPostManager.SetSlugUrlAsync(blogPost, input.Slug);
            }

            await BlogPostRepository.UpdateAsync(blogPost);

            return(ObjectMapper.Map <BlogPost, BlogPostDto>(blogPost));
        }
示例#2
0
        public virtual async Task <BlogPostDto> UpdateAsync(Guid id, UpdateBlogPostDto input)
        {
            var blogPost = await BlogPostRepository.GetAsync(id);

            blogPost.SetTitle(input.Title);
            blogPost.SetShortDescription(input.ShortDescription);
            blogPost.SetContent(input.Content);
            blogPost.SetConcurrencyStampIfNotNull(input.ConcurrencyStamp);
            blogPost.CoverImageMediaId = input.CoverImageMediaId;

            if (blogPost.Slug != input.Slug)
            {
                await BlogPostManager.SetSlugUrlAsync(blogPost, input.Slug);
            }

            await BlogPostRepository.UpdateAsync(blogPost);

            return(ObjectMapper.Map <BlogPost, BlogPostDto>(blogPost));
        }
示例#3
0
 public virtual Task<BlogPostDto> UpdateAsync(Guid id, UpdateBlogPostDto input)
 {
     return BlogPostAdminAppService.UpdateAsync(id, input);
 }