public ActionResult GenerateBoardDoc(string id, string boardLists, string listsWithCommentsIds) { AddDefaultParameters(); var board = RestMethods.GetBoard(id, RestClient); if (board == null) { return(RedirectToAction("Index", "Home")); } if (boardLists != null) { var arrOfId = boardLists.Split(','); string[] commentsListIds = {}; if (listsWithCommentsIds != null) { commentsListIds = listsWithCommentsIds.Split(','); } var trelloList = arrOfId.Select(listId => RestMethods.GetList(listId, RestClient)).ToList(); board.Lists = trelloList; foreach (var list in board.Lists) { list.Cards = RestMethods.GetListCards(list.Id, RestClient); foreach (var card in list.Cards) { card.Attachments = RestMethods.GetCardAttachments(card.Id, RestClient).ToList(); card.Checklists = RestMethods.GetCardChecklists(card.Id, RestClient).ToList(); if (commentsListIds.Any(x => x == list.Id.ToString())) { card.Actions = RestMethods.GetCardActions(card.Id, RestClient).ToList(); } } } } byte[] fileContents; using (var memoryStream = new MemoryStream()) { WordExtraction.DocumentWithOpenXml(memoryStream, board); fileContents = memoryStream.ToArray(); } Response.AppendHeader("Content-Disposition", string.Format("inline; filename={0}.docx", board.Name)); return(new FileContentResult(fileContents, "application/vnd.openxmlformats-officedocument.wordprocessingml.document")); }
public ActionResult Details(string id) { if (TrelloToken == null) { return(RedirectToAction("AuthorizeToken")); } AddDefaultParameters(); var board = RestMethods.GetBoard(id, RestClient); var boardLists = RestMethods.GetAllLists(board.Id, RestClient); var trelloLists = boardLists as TrelloList[] ?? boardLists.ToArray(); foreach (var x in trelloLists) { x.HasComments = false; x.Checked = true; } board.Lists = trelloLists; return(View(board)); }