Exemplo n.º 1
0
        public virtual async Task <IActionResult> OnPostAsync()
        {
            var dto = ObjectMapper.Map <CreateEditCommentViewModel, CreateUpdateCommentDto>(ViewModel);
            await _service.UpdateAsync(Id, dto);

            return(NoContent());
        }
        public async Task Should_Update_A_Comment()
        {
            var newContent = "new content";

            var oldComment = (await _commentRepository.GetListAsync()).FirstOrDefault();;

            await _commentAppService.UpdateAsync(oldComment.Id, new UpdateCommentDto()
            {
                Text = newContent
            });

            UsingDbContext(context =>
            {
                var comment = context.Comments.FirstOrDefault(q => q.Id == oldComment.Id);
                comment.Text.ShouldBe(newContent);
            });
        }
Exemplo n.º 3
0
 public Task <CommentWithDetailsDto> UpdateAsync(Guid id, UpdateCommentDto input)
 {
     return(_commentAppService.UpdateAsync(id, input));
 }
Exemplo n.º 4
0
 public async Task Update(Guid id, UpdateCommentDto commentDto)
 {
     await _commentAppService.UpdateAsync(id, commentDto);
 }
Exemplo n.º 5
0
 public Task <CommentDto> UpdateAsync(Guid id, CreateUpdateCommentDto input)
 {
     return(_service.UpdateAsync(id, input));
 }