public void ShouldDeleteCustomerAndReturnError() { var request = new CustomerDeleteRequest(Guid.NewGuid()); customerDeleteUseCase.Execute(request); presenter.ViewModel.Should().BeOfType <BadRequestObjectResult>(); }
public IActionResult DeleteCustomer([FromBody] InputCustomer input) { var request = new CustomerDeleteRequest(input.CustomerId); customerDeleteUseCase.Execute(request); return(presenter.ViewModel); }
public void ShouldDeleteCustomer() { var request = new CustomerDeleteRequest(CustomerId); customerDeleteUseCase.Execute(request); presenter.ViewModel.Should().BeOfType <OkObjectResult>(); }
public async Task <IWrappedResponse> Delete(CustomerDeleteRequest request) { var cmd = ServiceCommand <Customer, Rules.Customer.Delete.MainRule> .Create(_serviceProvider) .When(new Rules.Customer.Delete.MainRule(request)) .Then(DeleteAction); return(await cmd.Execute()); }
public async Task <ActionResult <Customer> > Delete(int id) { var request = new CustomerDeleteRequest { Id = id }; return(await _customersService.Delete(request).Convert <Customer>(this)); }
public bool Delete(CustomerDeleteRequest deleteRequest) { using (DataAccess dataAccess = new DataAccess()) { var customerdeleted = dataAccess.Customers.Where(x => x.CustomerID == deleteRequest.CustomerID) .FirstOrDefault <Customer>(); customerdeleted.StatusID = false; dataAccess.Update(customerdeleted); return(dataAccess.SaveChanges() > 0); } }
public SimpleResponse <bool> Delete(CustomerDeleteRequest request) { var entity = new CustomerEntity(); entity.CustomerId = request.CustomerId; var deleted = false; using (var adapter = DataAccessAdapterFactory.NewDataAccessAdapter()) { OnBeforeCustomerDeleteRequest(adapter, request, entity); deleted = adapter.DeleteEntity(entity); OnAfterCustomerDeleteRequest(adapter, request, entity, ref deleted); } return(new SimpleResponse <bool> { Result = deleted }); }
partial void OnAfterCustomerDeleteRequest(IDataAccessAdapter adapter, CustomerDeleteRequest request, CustomerEntity entity, ref bool deleted);
partial void OnBeforeCustomerDeleteRequest(IDataAccessAdapter adapter, CustomerDeleteRequest request, CustomerEntity entity);
public MainRule(CustomerDeleteRequest request, IRule parentRule = null) { // Create Context Context = new ContextModel(request, this); ParentRule = parentRule; }