Example #1
0
        public void createVaultKind(vaultkind vaultKind)
        {
            using (var db = new DataContext())
            {
                db.vaultkind.Add(vaultKind);

                try
                {
                    db.SaveChanges();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
        }
 public void NewAction(object commandParam)
 {
     vaultkind newvault = new vaultkind();
     Vaults.Add(newvault);
     SelectedItem = newvault;
 }
Example #3
0
        public void updateVaultKind(vaultkind vaultKind)
        {
            if (vaultKind.vaultkind_id != 0)
            {
                using (var db = new DataContext())
                {
                    var query = (from qvaultkind in db.vaultkind
                                where qvaultkind.vaultkind_id == vaultKind.vaultkind_id
                                select qvaultkind).First();

                    query.name = vaultKind.name;
                    query.description = vaultKind.description;

                    try
                    {
                        db.SaveChanges();
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                    }
                }
            }
            else
            {
                createVaultKind(vaultKind);
            }
        }