public async Task Delete(Guid id)
        {
            NaturalPerson person = await _naturalPersonRepository.GetById(id);

            _naturalPersonRepository.Delete(person);
            _addressRepository.Delete(person.Address);
            _documentRepository.Delete(person.Document);

            await _unitOfWork.Commit();
        }
        public async Task Update(NaturalPersonDto dto)
        {
            NaturalPerson person = await _naturalPersonRepository.GetById(dto.Id);

            UpdateNaturalPerson(dto, person);

            await _updateAddressService.Update(person.AddressId, dto.Address);

            await _updateDocumentService.Update(person.DocumentId, dto.Document);

            if (!person.Validate())
            {
                NotifyDomainValidations(person.ValidationResult);
            }

            if (!_notifier.HasNotification())
            {
                _naturalPersonRepository.Update(person);
                await _unitOfWork.Commit();
            }
        }
Ejemplo n.º 3
0
 public NaturalPerson GetById(long Id)
 {
     return(naturalPersonRepository.GetById(Id));
 }