Example #1
0
        /// <summary>
        /// Delete parent Async (soft-delete)
        /// </summary>
        /// <exception cref="NotFoundException">No matching parent could be found.</exception>
        /// <param name="parentId">Tenant ID.</param>
        /// <returns></returns>
        public async Task DeleteAsync(Guid parentId)
        {
            var parentEntity = await _parentRepository.GetByIdAsync(parentId);

            if (parentEntity.IsNull())
            {
                throw new NotFoundException(parentId, _objectType);
            }
            await _addressBusiness.DeleteAsync(parentEntity.Address.Id);

            await _parentRepository.RemoveAsync(parentEntity);

            await _parentRepository.SaveChangesAsync();
        }