Ejemplo n.º 1
0
        private Content CreateContent(HttpPostedFileBase contentFile, Artifact artifact, DateTime publishDate, User creator)
        {
            CloudBlockBlob contentBlob;
            Content        content = new Content();

            if (contentFile != null && contentFile.ContentLength != 0)
            {
                contentBlob = BlobUtils.UploadAndSaveBlob(cmsContentBlobContainer, contentFile);

                content.Artifact    = artifact;
                content.ArtifactId  = artifact.ArtifactId;
                content.ContentUrl  = contentBlob.Uri.ToString();
                content.CreatorId   = creator.UserId;
                content.CreateDate  = DateTime.Now.Date;
                content.PublishDate = publishDate;
                if (artifact.Version > 0)
                {
                    artifact.Version++;
                }
                content.Version = artifact.Version;
            }

            return(content);
        }