static internal object ToProjectItemFileResponse(this Posting posting)
        {
            ProjectItem     projectItem = posting.GetNodeObjectItem <ProjectItem>();
            FormerMediaFile mediaFile   = posting.GetPostedItem <FormerMediaFile>();

            return(new {
                uid = posting.UID,
                postingTime = posting.PostingTime,
                postedBy = posting.PostedBy.ToShortResponse(),

                projectItem = projectItem.ToResponse(),

                mediaFile = mediaFile.ToResponse(),
            });
        }
Example #2
0
        public SingleObjectModel UploadProjectItemFile(string projectItemUID)
        {
            try {
                var request = HttpContext.Current.Request;

                var projectItem = ProjectItem.Parse(projectItemUID);

                Posting posting = MediaFilePostingServices.CreateMediaFilePosting(request, projectItem, "ProjectItem.MediaFile");

                FormerMediaFile mediaFile = posting.GetPostedItem <FormerMediaFile>();

                return(new SingleObjectModel(this.Request, mediaFile.ToResponse(),
                                             typeof(FormerMediaFile).FullName));
            } catch (Exception e) {
                throw base.CreateHttpException(e);
            }
        }
Example #3
0
        public SingleObjectModel UpdateProjectItemFile(string projectItemUID, string fileUID)
        {
            try {
                var request = HttpContext.Current.Request;

                var projectItem = ProjectItem.Parse(projectItemUID);

                var posting = Posting.Parse(fileUID);

                Assertion.Require(posting.NodeObjectUID == projectItem.UID,
                                  $"ProjectItem {projectItem.Name} does not have the file {posting.PostedItemUID}.");

                MediaFilePostingServices.UpdateMediaFilePosting(request, posting);

                FormerMediaFile mediaFile = posting.GetPostedItem <FormerMediaFile>();

                return(new SingleObjectModel(this.Request, mediaFile.ToResponse(),
                                             typeof(FormerMediaFile).FullName));
            } catch (Exception e) {
                throw base.CreateHttpException(e);
            }
        }