public string WriteValue(string key, string value) { var status = "Error"; try { if (ValueExists(key)) { this.ClearValue(key); } var ls = new LocalStorage(); ls.KeyString = key; ls.ValueString = value; db.LocalStorage.Add(ls); db.SaveChanges(); status = "OK"; } catch (Exception e) { status = e.Message; } return(status); }
public void Execute(object parameter) { var noteParameter = parameter as dynamic; if (noteParameter == null) { return; } System.Guid noteId = noteParameter?.InkId; switch (noteParameter.Type) { case "Ink": using (var db = new LocalStorageContext()) { var ink = db.Memes.Remove(db.Memes.Find(noteId)); db.SaveChanges(); } break; case "Bookmark": using (var db = new LocalStorageContext()) { var ink = db.Memes.Remove(db.Memes.Find(noteId)); db.SaveChanges(); } break; } }
public void Execute(object parameter) { var episodeWithState = parameter as EpisodeWithState; Episode episode = episodeWithState?.Episode; if (episode == null) { episode = parameter as Episode; } if (episode == null) { return; } using (var db = new LocalStorageContext()) { foreach (Favorite favEntity in db.Favorites) { if (favEntity.EpisodeId == episode.Id) { db.Favorites.Remove(favEntity); break; } } db.SaveChanges(); } }
private void SwipeDelete_Invoked(SwipeItem sender, SwipeItemInvokedEventArgs args) { dynamic output = args.SwipeControl.DataContext; System.Guid inkId = output.InkId; switch (output.Type) { case "Ink": using (var db = new LocalStorageContext()) { var ink = db.Memes.Remove(db.Memes.Find(inkId)); db.SaveChanges(); ReLoadNotes(); } break; case "Bookmark": using (var db = new LocalStorageContext()) { var ink = db.Memes.Remove(db.Memes.Find(inkId)); db.SaveChanges(); ReLoadNotes(); } break; } }
private void AppBarButton_Click(object sender, RoutedEventArgs e) { dynamic output = (sender as AppBarButton).DataContext; System.Guid inkId = output.InkId; switch (output.Type) { case "Ink": using (var db = new LocalStorageContext()) { var ink = db.Memes.Remove(db.Memes.Find(inkId)); db.SaveChanges(); ReLoadNotes(); } break; case "Bookmark": using (var db = new LocalStorageContext()) { var ink = db.Memes.Remove(db.Memes.Find(inkId)); db.SaveChanges(); ReLoadNotes(); } break; } }
private void DeleteButton_Click(object sender, RoutedEventArgs e) { if (_editingExisting) { using (var db = new LocalStorageContext()) { db.Memes.Remove(_inkNote); db.SaveChanges(); if (_data != null) { db.MemeData.Remove(_data); db.SaveChanges(); } } } }
public void FavoriteCurrentEpisode() { using (var db = new LocalStorageContext()) { db.Favorites.Add(new Favorite(CurrentEpisode)); db.SaveChanges(); } }
public void Execute(object parameter) { if (parameter == null || (parameter as Episode) == null) { return; } using (var db = new LocalStorageContext()) { db.Favorites.Add(new Favorite(parameter as Episode)); db.SaveChanges(); } }
public async void RemoveFavoritedEpisode(Episode episode) { using (var db = new LocalStorageContext()) { foreach (Favorite favEntity in db.Favorites) { if (episode == null) { break; } if (favEntity.EpisodeId == episode.Id) { db.Favorites.Remove(favEntity); break; } } db.SaveChanges(); } await LoadFavorites(); }