public static void AddFatura(Fatura fatura) { using (IzsuDBContext db = new IzsuDBContext()) { db.Fatura.Add(fatura); db.SaveChanges(); } }
public static void AddAbone(Abone abone) { using (IzsuDBContext db = new IzsuDBContext()) { db.Abone.Add(abone); db.SaveChanges(); } }
public static void DeleteAbone(int no) { using (IzsuDBContext db = new IzsuDBContext()) { var result = db.Abone.Where(a => a.AboneID == no).FirstOrDefault(); db.Abone.Remove(result); db.SaveChanges(); } }
public static void UpdateOdenenFatura(int faturaID) { using (IzsuDBContext db = new IzsuDBContext()) { var result = db.Fatura.Find(faturaID); result.Tahsilat = true; db.SaveChanges(); } }
public static void UpdateAbone(Abone abone) { using (IzsuDBContext db = new IzsuDBContext()) { var result = db.Abone.FirstOrDefault(a => a.AboneID == abone.AboneID); result.AboneAdSoyad = abone.AboneAdSoyad; result.AboneTuruID = abone.AboneTuruID; db.SaveChanges(); } }
private void btnKaydet_Click(object sender, EventArgs e) { Abone a = new Abone(); a.AboneNo = int.Parse(txtAdoneNo.Text); a.AboneAdSoyad = txtAdSoyad.Text; AboneTuru at = (AboneTuru)cBoxAboneTuru.SelectedItem; a.AboneTuruID = at.AboneTuruID; at.AboneTuruAd = "hususi"; using (IzsuDBContext context = new IzsuDBContext()) { context.Abone.Add(a); context.SaveChanges(); } }