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));
        }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
        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));
        }