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(), }); }
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); } }
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); } }