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)); }
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); }
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)); }
public async Task <Response <RemarkDto> > CancelRemarkAsync(CancelRemark command) => await PutAsync <RemarkDto>($"api/remarks/{command.RemarkId}/cancel", command);
public async Task HandleAsync(CancelRemark command) => await CreateForAuthenticatedUserAsync(command);