public CmisObject ToCmis(object o, bool includeRelationships) { CmisObject cmisObject = new CmisObject(); MediaContent content = (MediaContent)o; cmisObject.Id = ObjectService.GetObjectId(content); cmisObject.Properties = new CmisProperties() { Items = content.Keys.Select(key => CmisPropertyHelper.CreateProperty(key, content[key])).ToArray() }; cmisObject.Properties.Items = cmisObject.Properties.Items.Concat(new CmisProperty[] { CmisPropertyHelper.CreateCmisPropertyCreatedBy(new [] { content.UserId }), CmisPropertyHelper.CreateCmisPropertyCreationDate(new [] { content.UtcCreationDate }), CmisPropertyHelper.CreateCmisPropertyLastModificationDate(new [] { content.UtcLastModificationDate }), CmisPropertyHelper.CreateCmisPropertyName(new [] { content.UserKey }), CmisPropertyHelper.CreateCmisPropertyObjectId(new [] { cmisObject.Id }), CmisPropertyHelper.CreateCmisPropertyBaseTypeId(new [] { "cmis:document" }), CmisPropertyHelper.CreateCmisPropertyObjectTypeId(new [] { content.FolderName }), }).ToArray(); if (includeRelationships) { var categories = Services.ServiceFactory.TextContentManager.QueryCategories(content.GetRepository(), content.FolderName, content.UUID); cmisObject.Relationship = categories.Select(it => it.Contents).SelectMany(it => it.Select(c => ObjectConvertor.ToCmis(c, includeRelationships))).ToArray(); } return(cmisObject); }
public void UpdateMediaContent(MediaContent mediaContent) { try { var mediaExists = _unitOfWork.MediaRep.GetById(mediaContent.ContentId); if (mediaExists == null) { throw new Exception("Media is not exists to update"); } mediaExists.Title = mediaContent.Title; mediaExists.Episode = mediaContent.Episode; mediaExists.Genre = mediaContent.Genre; mediaExists.TimeLength = mediaContent.TimeLength; mediaExists.ReleaseDate = mediaContent.ReleaseDate; mediaExists.Distributor = mediaContent.Distributor; mediaExists.Language = mediaContent.Language; mediaExists.AverageRating = mediaContent.AverageRating; mediaExists.HeroineName = mediaContent.HeroineName; mediaExists.HeroName = mediaContent.HeroName; mediaExists.Director = mediaContent.Director; mediaExists.Producer = mediaContent.Producer; mediaExists.ProductionHouse = mediaContent.ProductionHouse; _unitOfWork.MediaRep.Update(mediaExists); _unitOfWork.Save(); } catch (SqlException ex) { throw new Exception(ex.Message); } }
/// <summary> /// Constructor. /// </summary> /// <param name="sfContent">The sf content.</param> public MediaModel(MediaContent sfContent) : base(sfContent) { // TODO: Extract to factory class IWebHelper webHelper = new WebHelper(); if (sfContent != null) { Description = sfContent.Description; Author = sfContent.Author; Ordinal = sfContent.Ordinal; Url = webHelper.ResolveUrl("~" + sfContent.Urls[0].Url); Slug = sfContent.UrlName; Extension = sfContent.Extension; MimeType = sfContent.MimeType; TotalSize = sfContent.TotalSize; ViewsCount = sfContent.ViewsCount; Parent = new LibraryModel(sfContent.Parent); Status = sfContent.Status; Active = sfContent.Status == ContentLifecycleStatus.Live && sfContent.Visible; // TODO: Sometimes gets null exception, find better prevention instead of try/catch. Works when retrieving single item but not collection. try { ThumbnailUrl = sfContent.ThumbnailUrl; } catch { ThumbnailUrl = Url; } // TODO: Sometimes gets null exception, find better prevention instead of try/catch. Works when retrieving single item but not collection. try { MediaUrl = sfContent.MediaUrl; } catch { MediaUrl = Url; } // Populate taxonomies to list Categories = sfContent.GetTaxa("Category"); Tags = sfContent.GetTaxa("Tags"); } }
private S3DownloadedFile DownloadFileFromS3(string providerName, string libraryName, string fileName) { LibrariesManager librariesManager = LibrariesManager.GetManager(providerName); var docLibs = librariesManager.GetDocumentLibraries(); MediaContent document = null; Stream tempStream = null; MemoryStream fileStream = new MemoryStream(); foreach (var lib in docLibs) { if (lib.Title.ToLower() == libraryName) { document = lib.Items().Where(item => item.Title == fileName).FirstOrDefault(); tempStream = librariesManager.Download(document); } } if (tempStream != null) { tempStream.CopyTo(fileStream); fileStream.Position = 0; } return(new S3DownloadedFile { Document = document, FileStream = fileStream }); }
public async Task <IActionResult> Edit(int id, [Bind("ContentId,MediaId,ContentItemOrder,ContentItem")] MediaContent mediaContent) { if (id != mediaContent.ContentId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(mediaContent); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MediaContentExists(mediaContent.ContentId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["MediaId"] = new SelectList(_context.Media, "Id", "Author", mediaContent.MediaId); return(View(mediaContent)); }
private static void TestOthers(BuildDocumenter documenter, TestOptions options) { string helpRegisterDir = Path.Combine(sampleDir, @"SampleRegisterTopics\"); // Prepare the documents and project file paths //string projectFile = Path.Combine(helpRegisterDir, "Topics.xml"); string projectFile = Path.Combine(helpRegisterDir, "Topics.sandtopics"); string documentsDir = Path.Combine(helpRegisterDir, "Documents"); // First add the conceptual contents for the topics... ConceptualGroup registerGroup = new ConceptualGroup( "HelpRegister User Manual", TestGroupIds.RegisterTopicsGroupId); registerGroup.RunningHeaderText = "Sandcastle HelpRegister: User Manual"; registerGroup.CreateContent(documentsDir, projectFile); string mediaLinks = Path.Combine(helpRegisterDir, "MediaContent.media"); MediaContent mediaContent = new MediaContent(mediaLinks, Path.Combine(helpRegisterDir, "Media")); //mediaContent.Load(); registerGroup.AddMedia(mediaContent); ConceptualContent content = registerGroup.Content; registerGroup.ContentFile = new BuildFilePath(Path.Combine(workingDir, "OtherConceptual" + BuildFileExts.ConceptualGroupExt)); content.ContentFile = new BuildFilePath(Path.Combine(workingDir, "OtherConceptual" + BuildFileExts.ConceptualContentExt)); documenter.AddGroup(registerGroup); }
public ActionResult _SaveProductImage(string eisSKU, MediaContent model) { if (Request.Files.Count == 0) { throw new ArgumentException("No image file attachment detected."); } // parsed and save the image to a file var file = Request.Files[0]; using (var ms = new MemoryStream()) { file.InputStream.CopyTo(ms); ms.Position = 0; model.Url = _imageHelper.SaveProductImage(eisSKU, ms.ToArray()); } model.Type = "CUSTOM"; if (model.Id == -1) { _productService.AddProductImage(model); } else { // delete the old image file var oldImage = _productService.GetProductImage(model.Id); _imageHelper.RemoveProductImage(oldImage.ParentId, oldImage.Url); _productService.UpdateProductImage(model.Id, model.Url, model.Caption); } return(Json(new { isUploaded = true, message = "Image file has been successfully uploaded" }, "text/html")); }
public async Task <ActionResult> UpdatePhotoUser() { long idUser = long.Parse(User.Identity.GetUserId()); try { HttpPostedFileBase file = Request.Files[0]; if (file != null) { long result = await SaveImageForUser(file, idUser); MediaContent CurrentMediaId = cms_db.GetObjMedia().Where(s => s.ObjTypeId == (int)EnumCore.ObjTypeId.nguoi_dung && s.ContentObjId == idUser).FirstOrDefault(); string userPhotoUrl = "/Media/no_photo.png"; if (CurrentMediaId != null) { userPhotoUrl = CurrentMediaId.FullURL; } return(Json("{\"photo_url\": \"" + userPhotoUrl + "\", \"result\": \"1\"}")); } else { return(Json("{\"photo_url\": \"" + "/Media/no_photo.png" + "\", \"result\": \"0\"}")); } } catch (Exception ex) { DataModel.DataStore.Core core = new DataModel.DataStore.Core(); core.AddToExceptionLog("UpdatePhotoUser", "AccountController", "Upload photo Error: " + ex.Message, idUser); return(Json("{\"photo_url\": \"" + "/Media/no_photo.png" + "\", \"result\": \"0\"}")); } }
public void Test1() { MediaContent binaryContent1 = new MediaContent(); binaryContent1.Repository = repository.Name; binaryContent1.FolderName = binaryFolder.Name; binaryContent1.FileName = "file1.jpg"; binaryContent1.VirtualPath = "~/file1.jpg"; Providers.DefaultProviderFactory.GetProvider <IMediaContentProvider>().Add(binaryContent1); MediaContent binaryContent2 = new MediaContent(); binaryContent2.Repository = repository.Name; binaryContent2.FolderName = binaryFolder.Name; binaryContent2.FileName = "file2.jpg"; binaryContent2.VirtualPath = "~/file2.jpg"; Providers.DefaultProviderFactory.GetProvider <IMediaContentProvider>().Add(binaryContent2); var query = binaryFolder.CreateQuery().OrderBy("id"); Assert.AreEqual(2, query.Count()); Assert.AreEqual("file1.jpg", query.First().FileName); Assert.AreEqual("file2.jpg", query.Last().FileName); Providers.DefaultProviderFactory.GetProvider <IMediaContentProvider>().Delete(binaryContent1); Assert.AreEqual(1, query.Count()); }
public async Task <MediaContent> AddObjMediaContent(MediaContent media) { MediaContent result = db.MediaContents.Add(media); await db.SaveChangesAsync(); return(result); }
public virtual MediaContent Add(Repository repository, MediaFolder mediaFolder, string fileName, Stream fileStream, bool @overrided, string userId, MediaContentMetadata metadata) { IsAllowExtension(fileName, mediaFolder.AllowedExtensions); var mediaContent = new MediaContent(repository.Name, mediaFolder.FullName); mediaContent.UserId = userId; mediaContent.Published = true; mediaContent.FileName = fileName; mediaContent.UserKey = fileName; mediaContent.UUID = fileName; mediaContent.ContentFile = new ContentFile() { Name = fileName, FileName = fileName, Stream = fileStream }; mediaContent.UtcLastModificationDate = mediaContent.UtcCreationDate = DateTime.UtcNow; mediaContent.Metadata = metadata; Provider.Add(mediaContent, @overrided); return(mediaContent); }
public HttpResponseMessage GetVideo(long VideoId) { string sessionId = ""; CookieHeaderValue cookie = Request.Headers.GetCookies("ncoincookie").FirstOrDefault(); if (cookie != null) { sessionId = cookie["ncoincookie"].Value; } if (sessionId != "nguyenhuyvanguoidep") { return(null); } string fileName = ""; MediaContent objVideo = new MediaContent(); objVideo = db.MediaContents.Find(VideoId); if (objVideo != null) { fileName = objVideo.LinkHref; } var video = new VideoStream(fileName); Func <Stream, HttpContent, TransportContext, Task> func = video.WriteToStream; var response = Request.CreateResponse(); response.Content = new PushStreamContent(func, new MediaTypeHeaderValue("video/mp4")); return(response); }
public override void Upload(MediaContent content, Stream source, string extension, bool uploadAndReplace) { if (content is Image) { ImageUploadingEvent eventArgs = new ImageUploadingEvent { RawImageStream = source, ImageContentItem = content as Image }; this.OnImageUploading(eventArgs); if (eventArgs.RawImageChanged) { // Using a temp MemoryStream in order to prevent a closing/disposing // the Stream or Image (image obj which has been created from that stream and in case of disposing the image it will also dispose the stream) // earlier and causing a "A generic error occurred in GDI+" exception. using (MemoryStream tempStream = new MemoryStream()) { eventArgs.RawImageStream.CopyTo(tempStream); base.Upload(content, tempStream, extension); } this.OnImageUploaded(new ImageUploadedEvent() { RawImageStream = eventArgs.RawImageStream, ImageContentItem = content as Image }); return; } } base.Upload(content, source, extension, uploadAndReplace); }
public IHttpActionResult PutMediaContent(int id, MediaContent mediaContent) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != mediaContent.Id) { return(BadRequest()); } db.Entry(mediaContent).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!MediaContentExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public virtual ActionResult Upload(string folderName, string @return) { HttpFileCollectionBase files = Request.Files; MediaContent mediaContent = SaveFile(folderName, files); return(Redirect(@return)); }
public Guid CreateContent( Stream file, string mimeType, string ownerId, string title, string description, string coverImageUrl, Guid categoryId, Guid? collectionId, ContentType type) { var content = new MediaContent() { ContentType = type, AuthorId = ownerId, Title = title, Description = description, CoverImageUrl = coverImageUrl, MediaCategoryId = categoryId, MediaCollectionId = collectionId }; content.ContentUrl = this.Storage.UploadFile(file, content.Id.ToString(), mimeType); this.contents.Create(content); return content.Id; }
private async Task <MediaContentViewModels> SaveDefaultImageForTicker(HttpPostedFileBase file, long TickerId) { MediaContent CurrentMediaId = cms_db.GetObjMedia().Where(s => s.ObjTypeId == (int)EnumCore.ObjTypeId.ticker && s.MediaTypeId == (int)EnumCore.mediatype.hinh_anh_dai_dien && s.ContentObjId == TickerId).FirstOrDefault(); if (CurrentMediaId != null) { int rs = await cms_db.DeleteMediaContent(CurrentMediaId.MediaContentId); } ImageUploadViewModel item = new ImageUploadViewModel(); item = cms_db.UploadHttpPostedFileBase(file); MediaContentViewModels _Media = new MediaContentViewModels(); _Media.Filename = item.ImageName; _Media.FullURL = item.ImageUrl; _Media.ContentObjId = TickerId; _Media.ObjTypeId = (int)EnumCore.ObjTypeId.ticker; _Media.ViewCount = 0; _Media.MediaTypeId = (int)EnumCore.mediatype.hinh_anh_dai_dien; _Media.CrtdDT = DateTime.UtcNow; _Media.MediaContentSize = file.ContentLength; _Media.ThumbURL = item.ImageThumbUrl; _Media.CrtdUID = long.Parse(User.Identity.GetUserId()); await cms_db.AddNewMediaContent(_Media); return(_Media); }
public async Task <ActionResult> Delete(long id) { try { Ticker MainModel = cms_db.GetObjTicker(id); if (MainModel != null) { MediaContent _objoldmedia = cms_db.GetObjDefaultMediaByContentIdvsType(MainModel.TickerId, (int)EnumCore.ObjTypeId.ticker); if (_objoldmedia != null) { await cms_db.DeleteMediaContent(_objoldmedia.MediaContentId); } int dl = cms_db.DeleteContentPackage(id, (int)EnumCore.ObjTypeId.ticker); int result = await cms_db.DeleteTicker(MainModel); int ach = await cms_db.CreateUserHistory(long.Parse(User.Identity.GetUserId()), Request.ServerVariables["REMOTE_ADDR"], (int)EnumCore.ActionType.Delete, "Delete", MainModel.TickerId, MainModel.TickerName, "Ticker", (int)EnumCore.ObjTypeId.ticker); } return(RedirectToAction("Index")); } catch (Exception e) { cms_db.AddToExceptionLog("Delete", "TickerManager", e.ToString()); return(RedirectToAction("Index")); } }
public async Task <ActionResult> EditVideo(VideoViewModels model, HttpPostedFileBase Default_files) { if (ModelState.IsValid) { MediaContent MainModel = cms_db.GetObjMediaContent(model.MediaContentId); if (MainModel != null) { MainModel.Filename = model.Filename; MainModel.AlternativeText = model.AlternativeText; MainModel.Caption = model.Caption; MainModel.EXIFInfo = model.EXIFInfo; MainModel.MediaDesc = model.MediaDesc; MainModel.MetadataDesc = model.MetadataDesc; MainModel.MetadataKeyword = model.MetadataKeyword; MainModel.LinkHref = model.LinkHref; int rs = await cms_db.UpdateMediaContent(MainModel); if (Default_files != null) { MediaContentViewModels rsdf = await this.SaveDefaultImageForVideo(Default_files, MainModel.MediaContentId); int rsup = await this.UpdateImageUrlForVideo(rsdf, MainModel); } int SaveTickerPackage = this.SaveVideoPackage(model.lstTickerPackage, MainModel); int rs2 = await cms_db.CreateUserHistory(long.Parse(User.Identity.GetUserId()), Request.ServerVariables["REMOTE_ADDR"], (int)EnumCore.ActionType.Create, "EditVideo", MainModel.MediaContentId, MainModel.Filename, "MediaManage", (int)EnumCore.ObjTypeId.video); } return(RedirectToAction("VideoManager")); } return(RedirectToAction("VideoManager")); }
public virtual MediaContent Update(Repository repository, MediaFolder mediaFolder, string uuid, string fileName, Stream fileStream, string userid, MediaContentMetadata metadata) { IsAllowExtension(fileName, mediaFolder.AllowedExtensions); var binaryContent = mediaFolder.CreateQuery().WhereEquals("UUID", uuid).First(); var old = new MediaContent(binaryContent); binaryContent.UserId = userid; binaryContent.UtcLastModificationDate = DateTime.UtcNow; binaryContent.FileName = fileName; binaryContent.UserKey = fileName; binaryContent.UUID = fileName; if (fileStream != null) { binaryContent.ContentFile = new ContentFile() { Name = fileName, FileName = fileName, Stream = fileStream }; } binaryContent.Metadata = metadata; Provider.Update(binaryContent, old); return(binaryContent); }
public byte[] GetContentStream(MediaContent content) { using (var fs = File.Open(content.PhysicalPath, FileMode.Open, FileAccess.Read, FileShare.Read)) { return(fs.ReadData()); } }
private MediaContent GetMediaContent(MediaFolder mediaFolder, string filePath) { var fileName = Path.GetFileName(filePath); var folderPath = new FolderPath(mediaFolder); var creationDate = File.GetCreationTimeUtc(filePath); var lastModifiedDate = File.GetLastWriteTimeUtc(filePath); var fileInfo = new FileInfo(filePath); var mediaContent = new MediaContent() { UserKey = fileName, FileName = fileName, UUID = fileName, VirtualPath = UrlUtility.Combine(folderPath.VirtualPath, fileName), UtcCreationDate = creationDate, UtcLastModificationDate = lastModifiedDate, Size = fileInfo.Length, Repository = mediaFolder.Repository.Name, FolderName = mediaFolder.FullName, Published = IsPublished(filePath) }; metadataStorage.FillMetadata(mediaContent); return(mediaContent); }
public void SaveContentStream(MediaContent content, Stream stream) { using (FileStream file = new FileStream(content.PhysicalPath, FileMode.Create, System.IO.FileAccess.Write)) { ((MemoryStream)stream).WriteTo(file); } }
private async void UpdateStatus(string text, string pathToImage) { try { if (text == null && pathToImage == null) { return; } string mediaId = string.Empty; if (pathToImage != null) { _url = "https://upload.twitter.com/1.1/media/upload.json"; _aPIservice = new APIservice(); _mediaContent = new MediaContent(); var mdeiaContent = _mediaContent.MediaUpload(pathToImage, "media"); var resp = JsonConvert.DeserializeObject <User>(await _aPIservice.PostResponse(_url, null, mdeiaContent)); mediaId = resp.media_id_string; } _url = "https://api.twitter.com/1.1/statuses/update.json"; _aPIservice = new APIservice(); var data = new Dictionary <string, string> { { "status", text }, { "trim_user", "1" }, { "media_ids", mediaId } }; string response = await _aPIservice.PostResponse(_url, data, null); if (response != null) { DisplayAlert("Successful", "Your status is uploaded", "ok"); return; } }catch (Exception e) { } }
public void Add(MediaContent content, bool overrided) { if (content.ContentFile != null) { content.FileName = content.ContentFile.FileName; content.UserKey = content.FileName; content.UUID = content.FileName; // if the file already exist and dont need to overrided just return if (content.Exist() && !overrided) { return; } var contentPath = new MediaContentPath(content); content.VirtualPath = contentPath.VirtualPath; locker.EnterWriteLock(); try { content.ContentFile.Stream.SaveAs(contentPath.PhysicalPath); } finally { locker.ExitWriteLock(); } SetFilePublished(contentPath.PhysicalPath, content.Published); metadataStorage.SaveMetadata(content); } }
public async Task <Guid> AddMediaContent(IFormFile formFile) { byte[] buffer = new byte[formFile.Length]; using (Stream stream = formFile.OpenReadStream()) { int receivedCount = 0; do { receivedCount += await stream.ReadAsync(buffer, receivedCount, buffer.Length - receivedCount); }while (receivedCount != buffer.Length); } MediaContent mediaContent = new MediaContent { Id = Guid.NewGuid(), FileName = formFile.FileName, ContentType = formFile.ContentType, Content = buffer }; _mediaContentDataSource.Add(mediaContent); await _websiteDbContext.SaveChangesAsync(); return(mediaContent.Id); }
private MediaContentEntity Convert(MediaContent mediaContent) => new MediaContentEntity { Id = mediaContent.Id, FileName = mediaContent.FileName, ContentType = mediaContent.ContentType, Content = mediaContent.Content, };
public void TestSimple() { //var binaryContentProvider = Providers.GetProviderFactory(repository.DBProvider).GetProvider<IContentProvider<BinaryContent>>(); var binaryContent1 = new MediaContent(repository.Name, binaryFolder.Name); binaryContent1.UserKey = "image1"; binaryContent1.VirtualPath = "~/binary/image1.jpg"; binaryContent1.ContentFile = new ContentFile() { Name = "image1.jpg", FileName = "image1.jpg", Stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5, 6 }) }; binaryContentProvider.Add(binaryContent1); var binaryContent2 = new MediaContent(repository.Name, binaryFolder.Name); binaryContent2.UserKey = "image2"; binaryContent2.VirtualPath = "~/binary/image2.jpg"; binaryContent2.ContentFile = new ContentFile() { Name = "image2.jpg", FileName = "image2.jpg", Stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5, 6 }) }; binaryContentProvider.Add(binaryContent2); var query1 = binaryFolder.CreateQuery().WhereEquals("UUID", (string)(binaryContent1.UUID)); Assert.AreEqual(1, query1.Count()); var binaryContentItem1 = query1.First(); Assert.AreEqual(binaryContent1.UUID, binaryContentItem1.UUID); }
public async Task <ActionResult> Edit(ClassificationViewModels model) { Classification _ObjClass = model._ModelObj; ClassificationScheme _objScheme = cms_db.GetObjScheme(_ObjClass.ClassificationSchemeId); _ObjClass.LstModDT = DateTime.Now; _ObjClass.LstModUID = long.Parse(User.Identity.GetUserId()); if (model.IsEnabledbool == true) { _ObjClass.IsEnabled = 1; } if (model.IsEnabledbool == false) { _ObjClass.IsEnabled = 0; } int rs = await cms_db.EditClass(_ObjClass); MediaContent OldDefaultImg = cms_db.GetObjDefaultMediaByContentIdvsType(_ObjClass.ClassificationId, (int)EnumCore.ObjTypeId.danh_muc); MediaContent NewDefaultImg = cms_db.GetObjMediaContent(model.ImgdefaultId); int UpdateImage = await this.UpdateImageForClassifi(NewDefaultImg, OldDefaultImg, _ObjClass.ClassificationId); int rs2 = await cms_db.CreateUserHistory(long.Parse(User.Identity.GetUserId()), Request.ServerVariables["REMOTE_ADDR"], (int)EnumCore.ActionType.Create, "Create", _ObjClass.ClassificationId, _ObjClass.ClassificationNM, "Classification", (int)EnumCore.ObjTypeId.danh_muc); if (rs == (int)EnumCore.Result.action_true && rs2 == (int)EnumCore.Result.action_true) { return(RedirectToAction("Index", new { page = 1, SchemeId = _ObjClass.ClassificationSchemeId, ScheNM = _objScheme.ClassificationSchemeNM, classId = _ObjClass.ParentClassificationId.ToString() })); } return(RedirectToAction("Index", new { page = 1, SchemeId = _ObjClass.ClassificationSchemeId, ScheNM = _objScheme.ClassificationSchemeNM, classId = _ObjClass.ParentClassificationId.ToString() })); }
public ActionResult Edit(long id) { MediaContent model = new MediaContent(); model = cms_db.GetObjMediaContent(id); return(View(model)); }
public void MoveMetadata(MediaContent old, MediaContent @new) { var oldPath = GetMetadataFilePath(old); var newPath = GetMetadataFilePath(@new); File.Move(oldPath, newPath); }
public MediaContentPath(MediaContent content) { var mediaFolder = (MediaFolder)(content.GetFolder()); var folderPath = new FolderPath(mediaFolder); this.PhysicalPath = Path.Combine(folderPath.PhysicalPath, content.FileName); this.SettingFile = this.PhysicalPath; this.VirtualPath = UrlUtility.Combine(folderPath.VirtualPath, content.FileName); }
public void DeletePermanent(MediaContent entity) { this.contents.DeletePermanent(entity); this.contents.Save(); }
public void Delete(MediaContent entity) { this.contents.Delete(entity); this.contents.Save(); }
public void Create(MediaContent entity) { this.contents.Create(entity); this.contents.Save(); }
internal static void SeedMediaContents(EntertainmentSystemDbContext context) { const string DefaultCoverImageUrl = "https://dl.dropboxusercontent.com/1/view/jm0poduvuxj8ekh/Apps/EntertainmentSystem/88518440-dd5d-46e3-9f4a-7b2e8c3d8cec.jpg"; if (context.MediaContents.Any()) { return; } // add pictures var contentPicture_1 = new MediaContent { Title = "Varian Wrynn", Description = "World-of-Warcraft-Legion-Cinematic-Trailer-3.jpg", ContentUrl = "https://dl.dropboxusercontent.com/1/view/zkg913bztl4zrla/Apps/EntertainmentSystem/91cee43d-0904-4b58-983a-565e09ccd433.jpg", ContentType = ContentType.Picture, CoverImageUrl = DefaultCoverImageUrl, MediaCollectionId = context.MediaCollections.FirstOrDefault().Id, MediaCategoryId = context.MediaCategories.FirstOrDefault().Id, }; context.MediaContents.Add(contentPicture_1); var contentPicture_2 = new MediaContent { Title = "Durotan", Description = "Warcraft-Movie-Mobile-Wallpapers-1200x675.jpg", ContentUrl = "https://dl.dropboxusercontent.com/1/view/i1j0hpk6lpv2mjt/Apps/EntertainmentSystem/bb3f265e-6e89-4d66-9007-b0edeec2796e.jpg", ContentType = ContentType.Picture, CoverImageUrl = DefaultCoverImageUrl, MediaCollectionId = context.MediaCollections.FirstOrDefault().Id, MediaCategoryId = context.MediaCategories.FirstOrDefault().Id, }; context.MediaContents.Add(contentPicture_2); var contentPicture_3 = new MediaContent { Title = "Garona", Description = "garona_warcraft_movie-720x1280.jpg", ContentUrl = "https://dl.dropboxusercontent.com/1/view/b38orxfoi4dj82n/Apps/EntertainmentSystem/b22fc1cc-9b12-4bfe-920b-5594a97b4ab3.jpg", ContentType = ContentType.Picture, CoverImageUrl = DefaultCoverImageUrl, MediaCollectionId = context.MediaCollections.FirstOrDefault().Id, MediaCategoryId = context.MediaCategories.FirstOrDefault().Id, }; context.MediaContents.Add(contentPicture_3); // add music var contentMusic_1 = new MediaContent { Title = "Over The Hills And Far Away", Description = "Nightwish - From the Tarja Turunen Era", ContentUrl = "https://dl.dropboxusercontent.com/1/view/jsgotquu23fqufw/Apps/EntertainmentSystem/84703708-f892-40b5-9472-597b86ab2c12.mp3", ContentType = ContentType.Music, CoverImageUrl = DefaultCoverImageUrl, MediaCategoryId = context.MediaCategories.FirstOrDefault().Id, }; context.MediaContents.Add(contentMusic_1); var contentMusic_2 = new MediaContent { Title = "Future World", Description = "Helloween - 1987 - Keeper of the Seven Keys pt. 1", ContentUrl = "https://dl.dropboxusercontent.com/1/view/rcruqp7z3252o7v/Apps/EntertainmentSystem/eea13170-6231-43b5-8f72-6c3a799f1316.mp3", ContentType = ContentType.Music, CoverImageUrl = DefaultCoverImageUrl, MediaCategoryId = context.MediaCategories.FirstOrDefault().Id, }; context.MediaContents.Add(contentMusic_2); var contentMusic_3 = new MediaContent { Title = "The Sound of Silence", Description = "Disturbed - Immortalized (Deluxe Edition) [2015] Immortalized(Deluxe Edition) 2015", ContentUrl = "https://dl.dropboxusercontent.com/1/view/3y6eo5y5gjhsqm3/Apps/EntertainmentSystem/b900d55e-c583-45f1-92d0-f7641ef4cee4.mp3", ContentType = ContentType.Music, CoverImageUrl = DefaultCoverImageUrl, MediaCategoryId = context.MediaCategories.FirstOrDefault().Id, }; context.MediaContents.Add(contentMusic_3); // add videos var contentVideo_1 = new MediaContent { Title = "Big buck bunny", Description = "big-buck-bunny_trailer.webm", ContentUrl = "https://dl.dropboxusercontent.com/1/view/h1n1noiw8m5b1c6/Apps/EntertainmentSystem/43d770db-e58f-4839-96e4-75e8635f03c2.webm", ContentType = ContentType.Video, CoverImageUrl = DefaultCoverImageUrl, MediaCategoryId = context.MediaCategories.FirstOrDefault().Id, }; context.MediaContents.Add(contentVideo_1); var contentVideo_2 = new MediaContent { Title = "Happy feet 2", Description = "happyfit2.webm", ContentUrl = "https://dl.dropboxusercontent.com/1/view/8guai7hzb7bccjh/Apps/EntertainmentSystem/ef1cc222-4328-4710-a580-128019913ed4.webm", ContentType = ContentType.Video, CoverImageUrl = DefaultCoverImageUrl, MediaCategoryId = context.MediaCategories.FirstOrDefault().Id, }; context.MediaContents.Add(contentVideo_2); var contentVideo_3 = new MediaContent { Title = "Warcraft", Description = "From Legendary Pictures and Universal Pictures comes Warcraft," + " an epic adventure of world-colliding conflict based on Blizzard" + " Entertainment’s global phenomenon. The peaceful realm of Azeroth stands on" + " the brink of war as its civilization faces a fearsome race of invaders: Orc" + " warriors fleeing their dying home to colonize another. As a portal opens to" + " connect the two worlds, one army faces destruction and the other faces extinction." + " From opposing sides, two heroes are set on a collision course that will decide the" + " fate of their family, their people and their home. So begins a spectacular saga" + " of power and sacrifice in which war has many faces, and everyone fights for something.", ContentUrl = "https://dl.dropboxusercontent.com/1/view/tzbpdaf6e35qztt/Apps/EntertainmentSystem/571e0b77-9176-4f71-81fa-9a73063f8ba8.mp4", ContentType = ContentType.Video, CoverImageUrl = DefaultCoverImageUrl, MediaCollectionId = context.MediaCollections.FirstOrDefault().Id, MediaCategoryId = context.MediaCategories.FirstOrDefault().Id, }; context.MediaContents.Add(contentVideo_3); context.SaveChanges(); }
private void UploadImageFile(LibrariesManager libManager, MediaContent mediaItem) { var imageResource = "ProductsIntegrationTests.Images.1.jpg"; var assembly = this.GetType().Assembly; var stream = assembly.GetManifestResourceStream(imageResource); libManager.Upload(mediaItem, stream, ".jpg"); }
public void Update(MediaContent entity) { this.contents.Update(entity); this.contents.Save(); }