Esempio n. 1
0
        private void Lb_Click(object sender, EventArgs e)
        {
            Guid guid = Guid.Parse(((LinkButton)sender).ID);

            using (var dc = new PizzaNightDataContext())
            {
                LaserDisc disc = (from t in dc.LaserDiscs where t.ID == guid select t).FirstOrDefault();
                dc.LaserDiscs.DeleteOnSubmit(disc);
                dc.SubmitChanges();
            }

            FillTable();
        }
Esempio n. 2
0
        protected void AddMove_Click(object sender, EventArgs e)
        {
            if (tbTitle.Text != null)
            {
                using (var dc = new PizzaNightDataContext())
                {
                    LaserDisc newDisc = new LaserDisc()
                    {
                        ID      = Guid.NewGuid(),
                        Title   = tbTitle.Text,
                        Edition = tbEdition.Text
                    };

                    dc.LaserDiscs.InsertOnSubmit(newDisc);
                    dc.SubmitChanges();
                }
            }
            tbTitle.Text   = string.Empty;
            tbEdition.Text = string.Empty;
            tbTitle.Focus();

            FillTable();
        }