Ejemplo n.º 1
0
 /// <summary>
 /// Delete the specified ArtistAlbum from the storage and the collections
 /// </summary>
 /// <param name="artistAlbumToDelete"></param>
 /// <returns></returns>
 public static void DeleteArtistAlbum(ArtistAlbum artistAlbumToDelete)
 {
     // No need to wait for the ArtistAlbum to be deleted from storage
     DbAccess.DeleteAsync(artistAlbumToDelete);
     ArtistAlbumCollection.Remove(artistAlbumToDelete);
     IdLookup.Remove(artistAlbumToDelete.Id);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Add a new ArtistAlbum to the storage and the local collections
        /// </summary>
        /// <param name="artistAlbumToAdd"></param>
        public static async Task AddArtistAlbumAsync(ArtistAlbum artistAlbumToAdd)
        {
            ArtistAlbumCollection.Add(artistAlbumToAdd);

            // Need to wait for the ArtistAlbum to be added as that will set its ID
            await DbAccess.InsertAsync(artistAlbumToAdd);

            IdLookup[artistAlbumToAdd.Id] = artistAlbumToAdd;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Delete all the specified ArtistAlbum from the storage and the collections
 /// </summary>
 /// <param name="artistAlbumsToDelete"></param>
 /// <returns></returns>
 public static void DeleteArtistAlbums(IEnumerable <ArtistAlbum> artistAlbumsToDelete)
 {
     // No need to wait for the ArtistAlbums to be deleted from storage
     DbAccess.DeleteItemsAsync(artistAlbumsToDelete);
     foreach (ArtistAlbum artAlbum in artistAlbumsToDelete)
     {
         ArtistAlbumCollection.Remove(artAlbum);
         IdLookup.Remove(artAlbum.Id);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Get the Artists collection from storage
        /// </summary>
        /// <returns></returns>
        public static async Task GetDataAsync()
        {
            if (ArtistAlbumCollection == null)
            {
                // Get the current set of albums and form the lookup tables
                ArtistAlbumCollection = await DbAccess.LoadAsync <ArtistAlbum>();

                IdLookup = ArtistAlbumCollection.ToDictionary(alb => alb.Id);
            }
        }