예제 #1
0
        public Core.Dto.Customer Create(Core.Dto.Customer customerDto)
        {
            var customer = customerDto.ConvertToEntity();

            _unitOfWork.BeginTransaction();
            _unitOfWork.CustomerRepository.Create(customer);

            customerDto = customer.ConvertToDto();

            _unitOfWork.Commit();

            return(customerDto);
        }
예제 #2
0
        public Core.Dto.Customer Update(Core.Dto.Customer customerDto)
        {
            var existingCustomerDto = _unitOfWork.CustomerRepository.Get(customerDto.Id).ConvertToDto();

            existingCustomerDto.Name        = customerDto.Name;
            existingCustomerDto.SecurityKey = customerDto.SecurityKey;
            existingCustomerDto.Enabled     = customerDto.Enabled;
            _unitOfWork.BeginTransaction();

            var customer = _unitOfWork.CustomerRepository.Update(existingCustomerDto.ConvertToEntity());

            _unitOfWork.Commit();

            customerDto = customer.ConvertToDto();

            return(customerDto);
        }
예제 #3
0
 public Core.Dto.Customer Put(Core.Dto.Customer customer)
 {
     return(_customerService.Update(customer));
 }
예제 #4
0
 public Core.Dto.Customer Post(Core.Dto.Customer customer)
 {
     return(_customerService.Create(customer));
 }