Пример #1
0
        public async Task <IActionResult> Cancel(Guid id, [FromBody] CancelRemark command)
        {
            var remark = await _remarkService.CancelAsync(command);

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

            return(Ok(dto));
        }
Пример #2
0
        public async Task <Remark> CancelAsync(CancelRemark command)
        {
            var remark = await _context.Remarks.SingleOrDefaultAsync(x => x.Id == command.RemarkId);

            remark.Status = RemarkStatus.Canceled;

            await _context.SaveChangesAsync();

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

            return(remark);
        }
Пример #3
0
        public async Task <IActionResult> Cancel(Guid id)
        {
            var userId = HttpContext.GetUserId();

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

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

            return(Ok(result));
        }
Пример #4
0
 public async Task <Response <RemarkDto> > CancelRemarkAsync(CancelRemark command)
 => await PutAsync <RemarkDto>($"api/remarks/{command.RemarkId}/cancel", command);
Пример #5
0
 public async Task HandleAsync(CancelRemark command)
 => await CreateForAuthenticatedUserAsync(command);