コード例 #1
0
        public async Task <BlogDto> UpdateBlog(UpdateBlogInput input)
        {
            var blog = await _blogRepository.GetAsync(input.Id.Value);

            input.MapTo(blog);

            var dto = blog.MapTo <BlogDto>();

            return(dto);
        }
コード例 #2
0
        public async Task Update(UpdateBlogInput input)
        {
            var entity = await _manager.GetById(input.Id);

            if (entity == null)
            {
                throw new UserFriendlyException($"Blog {input.Id} not found");
            }

            entity.Update(input.Name);

            await _manager.Update(entity);
        }