Exemplo n.º 1
0
 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);
     }));
 }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 5
0
 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}"));
 }