コード例 #1
0
 public void TestInit()
 {
     batchSize           = 1;
     context             = new InMemoryEcaContext();
     indexService        = new Mock <IIndexService>();
     notificationService = new Mock <IIndexNotificationService>();
     service             = new ProjectDocumentService(context, indexService.Object, notificationService.Object, batchSize);
 }
コード例 #2
0
        public ProjectDocumentModel Post([FromBody] ProjectDocumentModel projectDoc)
        {
            Response.StatusCode = 201;

            string result = ProjectDocumentService.AddProjectDocument(projectDoc, dbConn);

            projectDoc.Id = Convert.ToInt32(result);
            return(projectDoc);
        }
コード例 #3
0
        public void TestConstructor()
        {
            batchSize = 1;
            service   = new ProjectDocumentService(context, indexService.Object, notificationService.Object, batchSize);
            Assert.AreEqual(batchSize, service.GetBatchSize());

            var batchSizeField = typeof(ProjectDocumentService).BaseType.GetField("batchSize", BindingFlags.Instance | BindingFlags.NonPublic);
            var batchSizeValue = batchSizeField.GetValue(service);

            Assert.AreEqual(batchSize, batchSizeValue);
        }
コード例 #4
0
        public IActionResult DownloadFile([FromRoute] string filename)
        {
            byte[] fileBytes = ProjectDocumentService.DownloadFile(filename).Result;

            var    provider = new FileExtensionContentTypeProvider();
            string contentType;

            if (!provider.TryGetContentType(filename, out contentType))
            {
                contentType = "application/octet-stream";
            }
            return(new FileContentResult(fileBytes, contentType));
        }
コード例 #5
0
 public string GetTempLink([FromRoute] string foldername, [FromRoute] string filename)
 {
     return(ProjectDocumentService.GetTempLink(foldername + '/' + filename));
 }
コード例 #6
0
 public List <string> GetBucketContents()
 {
     return(ProjectDocumentService.ListStorage().Result);
 }
コード例 #7
0
 public string UploadFile(IFormFile file, [FromRoute] int projectId)
 {
     return(ProjectDocumentService.UploadFile(file.OpenReadStream(), file.FileName, projectId.ToString()));
 }
コード例 #8
0
 public List <ProjectDocumentModel> Get([FromRoute] int projectId)
 {
     return(ProjectDocumentService.GetProjectDocs(projectId, dbConn));
 }
コード例 #9
0
 public string Delete([FromRoute] int id)
 {
     return(ProjectDocumentService.DeleteProjectDocument(id, dbConn));
 }