Example #1
0
        [Route("{id}")] //[bazwoyAdresAplikaci}/api/customers
        public IActionResult Delete([FromRoute] int id)
        {
            var customer = _customerRepository.Get(id);

            _customerRepository.Delete(customer);
            return(Ok());
        }
Example #2
0
        public void Delete(int customersId)
        {
            Customers customer = GetById(customersId);

            _customersRepository.Delete(customer);
            _unitOfWork.Complete();
        }
        public IActionResult Delete(int id)
        {
            var successful = _customersRepository.Delete(id);

            if (!successful)
            {
                return(NotFound());
            }

            return(NoContent());
        }
Example #4
0
 public bool Delete(客戶資料 customer)
 {
     if (customer == null)
     {
         return(false);
     }
     else
     {
         _customersRepository.Delete(customer);
         return(true);
     }
 }
Example #5
0
        public async Task <bool> DeleteCustomer(CustomerDto customer)
        {
            var CustomerToDelete = await _repoCustomer.GetOne <CustomerEntity>(x => x.IdCustmer == customer.IdCustmer).ConfigureAwait(false);

            if (CustomerToDelete != null)
            {
                await _repoCustomer.Delete(CustomerToDelete);

                return(true);
            }
            throw new NoExistingCustomerException("No existe el cliente que busca eliminar");
        }
        public async Task <Unit> Handle(DeleteCustomerCommand request, CancellationToken cancellationToken)
        {
            var customer = await _repository.Get(request.Id);

            if (customer is null)
            {
                throw new EntityNotFound(nameof(customer));
            }

            _repository.Delete(customer);
            await _repository.SaveChanges();

            return(Unit.Value);
        }
        public ActionResult <Result <CustomerDto> > Delete(Guid id)
        {
            var resultFromRepository = customersRepository.Delete(id);

            return(new Result <CustomerDto>
            {
                IsSuccess = resultFromRepository.IsSuccess,
                Message = resultFromRepository.Message,
                Value = resultFromRepository.Value != null
                    ? new CustomerDto
                {
                    Id = resultFromRepository.Value.Id,
                    Name = resultFromRepository.Value.Name,
                    Phone = resultFromRepository.Value.Phone,
                    AdditionalInfo = resultFromRepository.Value.AdditionalInfo
                }
                    : null
            });
        }
Example #8
0
        ///<Summary>
        ///Delete
        ///This method deletes one Customers record from the store
        ///</Summary>
        ///<returns>
        ///void
        ///</returns>
        ///<parameters>
        ///
        ///</parameters>
        public virtual void Delete()
        {
            Doing(this);
            IDAOCustomers daoCustomers = _iCustomersRepository.New();

            RegisterDataObject(_iCustomersRepository, _iCustomersRepository.BaseData(daoCustomers));
            BeginTransaction(_iCustomersRepository, "deleteBOCustomers");
            try
            {
                daoCustomers.CustomerID = _customerID;
                _iCustomersRepository.Delete(daoCustomers);
                CommitTransaction(_iCustomersRepository);
                Done(this);
            }
            catch (Exception ex)
            {
                Failed(this, ex);
                RollbackTransaction(_iCustomersRepository, "deleteBOCustomers");
                Handle(this, ex);
            }
        }
Example #9
0
 public bool Delete(int id)
 {
     return(_repo.Delete(id));
 }
 public bool Delete(string customerId)
 {
     return(_customersRepository.Delete(customerId));
 }