/// <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); }
/// <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; }
/// <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); } }
/// <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); } }