Beispiel #1
0
        public async Task DeleteConfigGenericItemAsync(DeleteConfigGenericItemDto request)
        {
            _logger.LogDebug($"Deleting config generic item with group Id {request.GroupId} and Id {request.Id}");

            var entity = await _dbContext.ConfigGenericItems.SingleOrDefaultAsync(x => x.GroupId == request.GroupId && x.Id == request.Id);

            if (entity != null)
            {
                _dbContext.Remove(entity);
                await _dbContext.SaveChangesAsync();
            }
            else
            {
                _logger.LogError($"Cannot delete config generic item with group Id {request.GroupId} and Id {request.Id}");
            }
        }
        public async Task DeleteConfigGenericItemExtentionValueAsync(ConfigGenericItemExtentionValueDto request)
        {
            _logger.LogDebug($"Delete config generic item extention value {JsonConvert.SerializeObject(request)}");

            var entity = await _dbContext.ConfigGenericItemExtensionValues.SingleOrDefaultAsync(x => x.GroupId == request.GroupId &&
                                                                                                x.ItemId == request.ItemId &&
                                                                                                x.ExtentionId == request.ExtentionId &&
                                                                                                x.Id == request.Id);

            if (entity != null)
            {
                _dbContext.Remove(entity);
                await _dbContext.SaveChangesAsync();
            }
            else
            {
                _logger.LogDebug($"Cannot delete config generic item extention value {JsonConvert.SerializeObject(request)}");
            }
        }