public object Get(BoardLaneRequest request) { var boards = new Dictionary <long, List <LaneName> >(); ILeanKitApi api; try { api = Connect(request); } catch (Exception ex) { ex.Message.Error(ex); return(ServerError(ex.Message)); } foreach (var boardId in request.BoardIds) { Board board; try { string.Format("Getting all lanes for board {0}", boardId).Debug(); board = api.GetBoard(boardId); } catch (Exception ex) { ex.Message.Error(ex); return(ServerError(ex.Message)); } var laneNames = new List <LaneName>(); var allLanes = new List <LeanKit.API.Client.Library.TransferObjects.Lane>(); allLanes.AddRange(board.Backlog); allLanes.AddRange(board.Lanes); allLanes.AddRange(board.Archive); foreach (var lane in allLanes.Where(x => x.ParentLaneId == 0)) { laneNames.Add(new LaneName { Id = lane.Id.GetValueOrDefault(), Name = lane.Title }); if (lane.ChildLaneIds.Count > 0) { GetChildLaneNames(laneNames, lane.Id.GetValueOrDefault(), lane.Title, allLanes); } } boards.Add(boardId, laneNames); } return(OK(boards)); }
public object Get(BoardLaneRequest request) { var boards = new Dictionary<long, List<LaneName>>(); ILeanKitApi api; try { api = Connect(request); } catch (Exception ex) { ex.Message.Error(ex); return ServerError(ex.Message); } foreach (var boardId in request.BoardIds) { Board board; try { string.Format("Getting all lanes for board {0}", boardId).Debug(); board = api.GetBoard(boardId); } catch (Exception ex) { ex.Message.Error(ex); return ServerError(ex.Message); } var laneNames = new List<LaneName>(); var allLanes = new List<LeanKit.API.Client.Library.TransferObjects.Lane>(); allLanes.AddRange(board.Backlog); allLanes.AddRange(board.Lanes); allLanes.AddRange(board.Archive); foreach (var lane in allLanes.Where(x => x.ParentLaneId == 0)) { laneNames.Add(new LaneName {Id = lane.Id.GetValueOrDefault(), Name = lane.Title}); if (lane.ChildLaneIds.Count > 0) { GetChildLaneNames(laneNames, lane.Id.GetValueOrDefault(), lane.Title, allLanes); } } boards.Add(boardId, laneNames); } return OK(boards); }