Exemple #1
0
        private void button21_Click(object sender, EventArgs e)
        {
            DBContext myDb = null;

            try
            {
                myDb = new DBContext();
                StoreModels.MoneyTransaction mt = myDb.moneyTransactions.Where(i => i.Code == 1).FirstOrDefault();
                myDb.moneyTransactions.Attach(mt);
                myDb.delete(mt);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #2
0
 private void button6_Click(object sender, EventArgs e)
 {
     try
     {
         StoreModels.MoneyTransaction mt = new StoreModels.MoneyTransaction()
         {
             CreationDate = DateTime.Now,
             IsPersonal   = true,
             TotalPrice   = 10000,
             Type         = StoreModels.MoneyTransaction.MTTypes.Hazine
         };
         DBContext myDB = new DBContext();
         myDB.save(mt);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }