public SessionCreationStatusResponse StartSession([FromRoute] long userId, [FromForm] CreateSessionParams sessionParams) { Session session = uploadService.createSession(userId, sessionParams.FileName, sessionParams.ChunkSize.Value, sessionParams.TotalSize.Value); return(SessionCreationStatusResponse.fromSession(session)); }
public ActionResult <SessionCreationStatusResponse> StartSession(CreateSessionParams sessionParams) { if (sessionParams.TotalSize > 400 * 1024 * 1024) { return(BadRequest("Maximum File Size Is 400 Mb.")); } var userId = HttpContext.User.Claims.First(c => c.Type == "sub").Value; Session session = UploadService.CreateSession(userId, sessionParams.FileName, sessionParams.TotalSize); return(SessionCreationStatusResponse.fromSession(session)); }
public void Validate(string username, string password, string domain) { // TODO maybe not hardcode this // TODO use securestring using (var client = new SessionServiceClient("WSHttpBinding_ISessionService")) { client.ClientCredentials.UserName.UserName = string.Format(@"{0}\{1}", domain, username); client.ClientCredentials.UserName.Password = password; var parameters = new CreateSessionParams() { LanguageCode = "EN" }; client.CreateSession(parameters); } }
public SessionCreationStatusResponse StartSession([FromRoute] long userId, [FromForm] CreateSessionParams sessionParams) { InsertFileRequest request = new InsertFileRequest() { CreatedDate = DateTime.Now, IdUser = 1, Name = "Teste", Size = 12213 }; var response = _serviceFile.InsertFile(request); Session session = uploadService.CreateSession(userId, sessionParams.FileName, sessionParams.ChunkSize.Value, sessionParams.TotalSize.Value); return(SessionCreationStatusResponse.fromSession(session)); }
public void TestChunkedUpload() { api = new FileController(); originalData = generateRandomArray(FILE_SIZE); string fileName = Guid.NewGuid().ToString(); var parameters = new CreateSessionParams { FileName = fileName, TotalSize = FILE_SIZE, ChunkSize = CHUNK_SIZE }; SessionCreationStatusResponse session = createSession(parameters, api); for (int i = 0; i < NUMBER_OF_CHUNKS; i++) { uploadChunk(session.SessionId, i); } byte[] downloadedData = downloadFile(session.SessionId); Assert.Equal(SHAsum(originalData), SHAsum(downloadedData)); }
private SessionCreationStatusResponse createSession(CreateSessionParams parameters, FileController api) { return(api.StartSession(USER_ID, parameters)); }
public void Post([FromBody] CreateSessionParams parameters) { _sessionService.Create(_mapper.Map <Session>(parameters)); }