public override async Task DeleteAsync(int id)
        {
            var entity = await GetByIdAsync(id).ConfigureAwait(false);

            if (entity != null)
            {
                foreach (var item in entity.ManyItems)
                {
                    await ManyEntityController.DeleteAsync(item.Id).ConfigureAwait(false);
                }
                await OneEntityController.DeleteAsync(entity.Id).ConfigureAwait(false);
            }
            else
            {
                throw new LogicException(ErrorType.InvalidId);
            }
        }
Beispiel #2
0
        public override async Task DeleteAsync(int id)
        {
            var entity = await GetByIdAsync(id).ConfigureAwait(false);

            if (entity != null)
            {
                if (entity.AnotherItem.Id > 0)
                {
                    await AnotherEntityController.DeleteAsync(entity.AnotherItem.Id).ConfigureAwait(false);
                }
                await OneEntityController.DeleteAsync(entity.Id).ConfigureAwait(false);
            }
            else
            {
                throw new LogicException(ErrorType.InvalidId);
            }
        }