protected void MakeProjectDocument(ClientProjectDocument document) { PopulateTags(document); document.FileContents = UploadFile(document.File); ProjectDocument _document = new ProjectDocument(document.ProjectId, document.Title, document.TypeKey, document.Description, document.Tags); _document.Save(); foreach (string tagText in document.Tags) { Tag tag = new Tag(tagText); tag.Save(); ProjectDocumentTag docTag = new ProjectDocumentTag(_document.Id, tag); docTag.Save(); } ProjectDocumentContentTypeCode _contentType = null; try { _contentType = new ProjectDocumentContentTypeCode(document.File.ContentType); } catch { _contentType = new ProjectDocumentContentTypeCode() { Title = document.File.ContentType, Key = document.File.ContentType, Active = true, Order = 0 }; _contentType.Save(); } ProjectDocumentContent content = new ProjectDocumentContent(_document.Id, document.File.FileName, document.FileContents, _contentType.Id); content.Save(); }
public IActionResult OpenDocument(int documentId) { ProjectDocumentContent content = BTPBCommon.Platform.GetContentForDocumentId(documentId); return(File(content.Content, content.ContentType.Key)); }