Пример #1
0
 public async void AddSiteKey(SiteKeyItem sitekey)
 {
     using (var db = new CreatePassContext())
     {
         db.SiteKeys.Add(sitekey);
         await db.SaveChangesAsync();
     }
 }
Пример #2
0
 public SiteKeyItem GetSiteKey(int sitekeyId)
 {
     var sitekey = new SiteKeyItem();
     using (var db = new CreatePassContext())
     {
         sitekey = db.SiteKeys.FirstOrDefault(x => x.SiteKeyItemId == sitekeyId);
     }
     return sitekey;
 }
Пример #3
0
        public async void DeleteSiteKey(SiteKeyItem sitekey)
        {
            using (var db = new CreatePassContext())
            {
                sitekey = db.SiteKeys.FirstOrDefault(x => x.SiteKeyItemId == sitekey.SiteKeyItemId);

                db.SiteKeys.Remove(sitekey);
                await db.SaveChangesAsync();
            }
        }
Пример #4
0
 private void StackPanel_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e)
 {
     var stackpanelitem = (StackPanel)sender;
     SiteKeyItemFlyout.ShowAt(stackpanelitem, e.GetPosition(stackpanelitem));
     sitekeyRightClicked = (Model.SiteKeyItem)((FrameworkElement)sender).DataContext;
 }
Пример #5
0
 private void mf_deleteSiteKey_Click(object sender, RoutedEventArgs e)
 {
     if (sitekeyRightClicked != null)
     {
         try
         {
             var dbService = new Service.DbService();
             dbService.DeleteSiteKey(sitekeyRightClicked);
         }
         catch (Exception ex)
         {
             Debug.WriteLine($"DeleteSiteKey: {ex.Message}");
         }
         RefreshSiteKeyList();
     }
     //Reset
     sitekeyRightClicked = null;
 }