Пример #1
0
        internal string UploadData(string value)
        {
            if (Encoding.UTF8.GetByteCount(value) > 1000000)
            {
                throw new FileLoadException();
            }

            var data = new Data
            {
                Text = value,
                ContentType = "text/plain",
                CreatedDate = DateTime.UtcNow
            };

            _session.Store(data);

            return data.Id;
        }
Пример #2
0
        internal string UploadData(string fileName, string contentType, Stream stream)
        {
            if (stream.Length > 5000000)
            {
                throw new FileLoadException();
            }

            var path = _dropboxHelper.Upload(fileName, ReadFully(stream));
            var data = new Data
            {
                Url = path,
                ContentType = contentType,
                CreatedDate = DateTime.UtcNow
            };

            _session.Store(data);

            return data.Id;
        }