Exemple #1
0
        public void BrisiIgraca()
        {
            Igraci igraci = dgvIgraci.CurrentRow.DataBoundItem as Igraci;

            if (igraci != null)
            {
                using (var db = new TurnirEntities2())
                {
                    db.Igraci.Attach(igraci);
                    db.Igraci.Remove(igraci);
                    db.SaveChanges();
                }
            }
        }
Exemple #2
0
        public void DodajIgraca()
        {
            Ekipe ekipe = dgvEkipe.CurrentRow.DataBoundItem as Ekipe;

            using (var db = new TurnirEntities2())
            {
                Igraci igrac = new Igraci
                {
                    Ime     = txtImeIgraca.Text,
                    Prezime = txtPrezimeIgraca.Text,
                    EkipeId = ekipe.Id
                };
                db.Igraci.Add(igrac);
                db.SaveChanges();
            }
        }