Ejemplo n.º 1
0
        public IActionResult GetDocumentsArchiveToken(string volume, [FromBody] DocumentsRange range)
        {
            if (!TryGetSession(User, out Session _))
            {
                return(Unauthorized());
            }

            DocumentsSelection selection = new DocumentsSelection(range.DocumentIds, range.ExcludeMode)
            {
                ArchiveIfSingle = true
            };

            if (!selection.IsValid())
            {
                return(BadRequest("Selection parameter is not valid"));
            }

            string         sessionId = GetSessionId(User);
            DownloadTicket ticket    = SessionManager.CreateDownloadTicket(sessionId, volume, selection);

            return(Ok(new { ticket.Token }));
        }
Ejemplo n.º 2
0
        public IActionResult DeleteDocuments(string volume, [FromBody] DocumentsRange range)
        {
            if (!TryGetSession(User, out Session session))
            {
                return(Unauthorized());
            }

            if (!session.IsVolumeExist(volume))
            {
                return(NotFound(Resources.ErrorVolumeNotFound));
            }

            DocumentsSelection selection = new DocumentsSelection(range.DocumentIds, range.ExcludeMode);

            if (!selection.IsValid())
            {
                return(BadRequest());
            }

            session.DeleteSelection(volume, selection);

            return(Ok());
        }