public BaseMediaItem(string filePath, int index, DataModel.MediaItem data) { ACore = ACore = (AppCore) Application.Current.Properties[nameof(AppProps.AppCore)]; FilePath = filePath; Index = index; if (data == null) return; Id = data.Id; DirId = data.DirectoryId; Comment = data.Comment; Rating = data.Rating; Orientation = data.Orientation; Data = data; }
public void SaveMediaItemInToDb(bool update, bool isNew) { if (isNew) { ReadMetadata(); Id = ACore.Db.GetNextIdFor<DataModel.MediaItem>(); Data = new DataModel.MediaItem { Id = Id, DirectoryId = DirId, FileName = FileNameWithExt, Rating = Rating, Comment = Comment, Orientation = Orientation }; ACore.Db.InsertOnSubmit(Data); } else { if (update) ReadMetadata(); Data.Rating = Rating; Data.Comment = CommentEscaped; Data.Orientation = Orientation; ACore.Db.UpdateOnSubmit(Data); } SaveMediaItemKeywordsToDb(); SaveMediaItemPeopleInToDb(); }