示例#1
0
        private FormResult PostCreateUpload(long elementId, string name, string contentType, byte[] content)
        {
            // Get tenant identifier, website identifier
            long tenantId = _authenticationService.TenantId;

            // Get upload model
            CreateUploadModel model = new CreateUploadModel {
                Content     = content,
                ContentType = contentType,
                Name        = name,
                TenantId    = tenantId
            };

            // Create uploads, ready to be assigned to photo when form submitted
            IUploadElementService albumService = (IUploadElementService)_elementFactory.GetElementService(FormId);
            ImageUploadIds        uploadIds    = albumService.PrepareImages2(tenantId, elementId, model);

            // Return form result
            string status = string.Format("{0}|{1}|{2}", uploadIds.ThumbnailImageUploadId, uploadIds.PreviewImageUploadId, uploadIds.ImageUploadId);

            return(_formHelperService.GetFormResult(status));
        }
        private FormResult PostUpdateUserUpload(string id, string context, string name, string contentType, byte[] content)
        {
            // Get website details
            Web web = _authenticationService.Web;

            // Get upload model
            CreateUploadModel model = new CreateUploadModel
            {
                Content     = content,
                ContentType = contentType,
                Name        = name,
                TenantId    = web.TenantId
            };

            // Create uploads, ready to be assigned to user when form submitted
            ImageUploadIds uploadIds = _authenticationService.PrepareImages(web.TenantId, model);

            // Return form result
            string status = string.Format("{0}|{1}|{2}", uploadIds.ThumbnailImageUploadId, uploadIds.PreviewImageUploadId, uploadIds.ImageUploadId);

            return(_formHelperService.GetFormResult(status));
        }
示例#3
0
        /// <summary>
        /// Handles form upload.
        /// </summary>
        /// <param name="masterPageId">Master page with page image rules.</param>
        /// <param name="name">The name of the upload (e.g. "MyImage.png").</param>
        /// <param name="contentType">The type of the upload content (e.g. "image/png").</param>
        /// <param name="content">Byte buffer containing uploaded content.</param>
        /// <returns>Result of form upload post.</returns>
        private FormResult PostPageUpload(long masterPageId, string name, string contentType, byte[] content)
        {
            // Get tenant identifier, website identifier
            long tenantId = _authenticationService.TenantId;

            // Get upload model
            CreateUploadModel model = new CreateUploadModel
            {
                Content     = content,
                ContentType = contentType,
                Name        = name,
                TenantId    = tenantId
            };

            // Create uploads, ready to be assigned to page when form submitted
            ImageUploadIds uploadIds = _pageService.PrepareImages(tenantId, masterPageId, model);

            // Return form result
            string status = string.Format("{0}|{1}|{2}", uploadIds.ThumbnailImageUploadId, uploadIds.PreviewImageUploadId, uploadIds.ImageUploadId);

            return(_formHelperService.GetFormResult(status));
        }