private void btnDeleteAcc_Click(object sender, EventArgs e)
        {
            FinancialAccount selectedAccount = (FinancialAccount)CboAccounts.SelectedItem;

            FinancialAccountDB.Delete(selectedAccount);
            CboAccounts.Update();
            frmFinAccManager_Load(sender, e);
        }
 /// <summary>
 /// Adds a financial account to the DB
 /// </summary>
 /// <param name="acc"></param>
 /// <returns></returns>
 public static FinancialAccount Add(FinancialAccount acc)
 {
     using (var context = new RestaurantContext())
     {
         context.FinancialAccounts.Add(acc);
         context.SaveChanges();
     }
     return(acc);
 }
        private void btnSave_Click(object sender, EventArgs e)
        {
            FinancialAccount temp = new FinancialAccount();

            temp.AccountName        = txt_AccName.Text;
            temp.AccountDescription = txt_AccDescription.Text;
            FinancialAccountDB.Add(temp);
            frmFinAccManager_Load(sender, e);
        }
 /// <summary>
 /// Deletes a financial account from the DB
 /// </summary>
 /// <param name="acc"></param>
 public static void Delete(FinancialAccount acc)
 {
     using (var context = new RestaurantContext())
     {
         // TODO:  Complete Delete functionality
         context.FinancialAccounts.Attach(acc);
         context.Entry(acc).State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
 /// <summary>
 /// Updates/Edits all financial account data, except for PK
 /// </summary>
 /// <param name="acc"></param>
 /// <returns></returns>
 public static FinancialAccount Update(FinancialAccount acc)
 {
     using (var context = new RestaurantContext())
     {
         context.FinancialAccounts.Attach(acc);
         context.Entry(acc).State = EntityState.Modified;
         context.SaveChanges();
     }
     return(acc);
 }
 private void btnSelect_Click(object sender, EventArgs e)
 {
     FinancialAccount selectedAccount = (FinancialAccount)CboAccounts.SelectedItem;
 }