public Option <SuccessResult, ErrorResult> Delete(DeleteByIdCommand command) { return(_deleteByIdCommandValidator .Validate(command) .OnSuccess(errorBuilder => { var option = _projectRepository.GetById(command); option.MatchSome(x => _projectRepository.Delete(x)); })); }
public Option <SuccessResult, ErrorResult> Delete(DeleteByIdCommand command) { return(_deleteByIdCommandValidator .Validate(command) .OnSuccess(errorBuilder => { var option = _sceneRepository.GetById(command); option.MatchSome(x => _sceneRepository.Delete(x)); option.MatchNone(errorBuilder.AddRecordNotFound); })); }
public async Task <IActionResult> DeleteById([FromBody] DeleteByIdCommand command) { var success = await _mediator.Send(command); if (success) { return(Ok()); } else { return(NotFound()); } }
public async void DeletePaymentById() { IClient commerceToolsClient = this.paymentsFixture.GetService <IClient>(); Payment payment = this.paymentsFixture.CreatePayment(); var deleteCommand = new DeleteByIdCommand <Payment>(payment.Id, payment.Version) { DataErasure = true }; Payment deletedPayment = commerceToolsClient .ExecuteAsync( deleteCommand) .Result; NotFoundException exception = await Assert.ThrowsAsync <NotFoundException>(() => commerceToolsClient.ExecuteAsync( new GetByIdCommand <Cart>(deletedPayment.Id))); Assert.Equal(404, exception.StatusCode); }
public Task <Unit> Handle(DeleteByIdCommand <T, ID> request, CancellationToken cancellationToken) { throw new NotImplementedException(); }
public async Task <Option <SuccessResult, ErrorResult> > Delete(DeleteByIdCommand command) { return(await HttpClient.DeleteAsOptionAsync($"api/project/{command.Id}")); }