Example #1
0
        public async ValueTask <int> ExecuteAsync(CustomerEntity customerEntity)
        {
            if (customerEntity.Underage() == true)
            {
                throw new UseCaseException("Underage customers are not allowed");
            }

            if (string.IsNullOrEmpty(customerEntity.Name))
            {
                throw new UseCaseException("Customer name empty");
            }


            _unitOfWork.CustomerRepository.Update(customerEntity);

            return(_unitOfWork.SaveChanges());
        }