示例#1
0
        public void ShouldDeleteCustomerAndReturnError()
        {
            var request = new CustomerDeleteRequest(Guid.NewGuid());

            customerDeleteUseCase.Execute(request);
            presenter.ViewModel.Should().BeOfType <BadRequestObjectResult>();
        }
示例#2
0
        public IActionResult DeleteCustomer([FromBody] InputCustomer input)
        {
            var request = new CustomerDeleteRequest(input.CustomerId);

            customerDeleteUseCase.Execute(request);
            return(presenter.ViewModel);
        }
示例#3
0
        public void ShouldDeleteCustomer()
        {
            var request = new CustomerDeleteRequest(CustomerId);

            customerDeleteUseCase.Execute(request);
            presenter.ViewModel.Should().BeOfType <OkObjectResult>();
        }
示例#4
0
        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());
        }
示例#5
0
        public async Task <ActionResult <Customer> > Delete(int id)
        {
            var request = new CustomerDeleteRequest
            {
                Id = id
            };

            return(await _customersService.Delete(request).Convert <Customer>(this));
        }
示例#6
0
 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);
     }
 }
示例#7
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
            });
        }
示例#8
0
 partial void OnAfterCustomerDeleteRequest(IDataAccessAdapter adapter, CustomerDeleteRequest request, CustomerEntity entity, ref bool deleted);
示例#9
0
 partial void OnBeforeCustomerDeleteRequest(IDataAccessAdapter adapter, CustomerDeleteRequest request, CustomerEntity entity);
示例#10
0
 public MainRule(CustomerDeleteRequest request, IRule parentRule = null)
 {
     // Create Context
     Context    = new ContextModel(request, this);
     ParentRule = parentRule;
 }