public List <Columns> GetFullColumnName(Guid columnint) { List <Columns> list = new List <Columns>(); if (string.IsNullOrEmpty(columnint.ToString())) { return(list); } var column = _columnsRepository.Table.Where(c => c.Id == columnint).FirstOrDefault(); if (column == null) { return(list); } var columnList = StrTools.DelFAChar(column.ColumnList, ","); Guid[] lArray = columnList.Split(',').Select(s => Guid.Parse(s)).ToArray(); var _list = _columnsRepository.Table.Where(c => lArray.Contains(c.Id)).ToList(); foreach (var m in _list) { list.Add(m); } return(list); }
/// <summary> /// 获取栏目的名称列表 /// </summary> /// <param name="Id">要获取的栏目ID</param> /// <param name="splitStr">分割字符</param> /// <returns></returns> public string GetFullColumnName(Guid columnId, string splitStr) { if (string.IsNullOrEmpty(columnId.ToString())) { return(string.Empty); } var column = _columnsRepository.Table.Where(c => c.Id == columnId).FirstOrDefault(); if (column == null) { return(string.Empty); } var columnList = StrTools.DelFAChar(column.ColumnList, ","); Guid[] lArray = columnList.Split(',').Select(s => Guid.Parse(s)).ToArray(); var list = _columnsRepository.Table.Where(c => lArray.Contains(c.Id)).ToList(); string Categorystr = ""; foreach (var m in list) { if (list.IndexOf(m) == 0) { Categorystr += m.ColumnTitle; } else { Categorystr += splitStr + m.ColumnTitle; } } return(Categorystr); }