public ColumnKeyValueDTO GetColumnKeyValue(int columnID)
        {
            ColumnKeyValueDTO result = new ColumnKeyValueDTO();

            using (var projectContext = new MyIdeaEntities())
            {
                var column = projectContext.Column.FirstOrDefault(x => x.ID == columnID);
                if (column.ColumnKeyValue != null)
                {
                    return(ToColumnKeyValueDTO(column.ColumnKeyValue));
                }
            }
            return(null);
        }
        private ColumnKeyValueDTO ToColumnKeyValueDTO(ColumnKeyValue item)
        {
            ColumnKeyValueDTO result = new ColumnKeyValueDTO();

            result.ValueFromKeyOrValue = item.ValueFromKeyOrValue;
            result.ColumnKeyValueRange = new List <ColumnKeyValueRangeDTO>();
            foreach (var rItem in item.ColumnKeyValueRange)
            {
                var keyValueRange = new ColumnKeyValueRangeDTO();
                keyValueRange.ColumnID   = rItem.ColumnID;
                keyValueRange.ColumnName = item.Column.Name;
                keyValueRange.ID         = rItem.ID;
                keyValueRange.KeyTitle   = rItem.KeyTitle;
                keyValueRange.Value      = rItem.Value;
                result.ColumnKeyValueRange.Add(keyValueRange);
            }
            return(result);
        }