コード例 #1
0
        public async Task <IActionResult> Resolve(Guid id, [FromBody] ResolveRemark command)
        {
            var remark = await _remarkService.ResolveAsync(command);

            var dto = new RemarkDto
            {
                Id = remark.Id
            };

            return(Ok(dto));
        }
コード例 #2
0
        public async Task <Remark> ResolveAsync(ResolveRemark command)
        {
            var remark = await _context.Remarks.SingleOrDefaultAsync(x => x.Id == command.RemarkId);

            remark.Status = RemarkStatus.Resolved;

            await _context.SaveChangesAsync();

            await _bus.Publish(new RemarkResolved
            {
                RemarkId = remark.Id
            });

            return(remark);
        }
コード例 #3
0
        public async Task <IActionResult> Resolve(Guid id)
        {
            var userId = HttpContext.GetUserId();

            var command = new ResolveRemark
            {
                RemarkId = id,
                UserId   = userId
            };

            var result = await _remarkService
                         .ResolveRemarkAsync(command)
                         .OrFailAsync();

            return(Ok(result));
        }
コード例 #4
0
 public async Task <Response <RemarkDto> > ResolveRemarkAsync(ResolveRemark command)
 => await PutAsync <RemarkDto>($"api/remarks/{command.RemarkId}/resolve", command);
コード例 #5
0
 public async Task HandleAsync(ResolveRemark command)
 => await CreateForAuthenticatedUserAsync(command);