Пример #1
0
        public static FileAddParameter FromFileInfo(string name, Stream stream, string contentType)
        {
            var nameWithoutExtension = Path.GetFileNameWithoutExtension(name);
            var mediaType = MediaTypeUtility.ToMediaType(contentType);

            var result = new FileAddParameter(nameWithoutExtension, stream, mediaType);
            return result;
        }
Пример #2
0
        public static File Create(Guid id, FileAddParameter fileAddParameter)
        {
            var result = new File
            {
                Id = id,
                Name = fileAddParameter.Name,
                Size = fileAddParameter.Stream.Length,
                MediaType = fileAddParameter.MediaType
            };

            return result;
        }