public void Delete(PhieuHdChiTiet obj) { using (var db = new QLBH_WinDBContext()) { db.PhieuHdChiTiets.Attach(obj); db.PhieuHdChiTiets.Remove(obj); db.SaveChanges(); } }
public PhieuHdChiTiet Insert(PhieuHdChiTiet obj) { using (var db = new QLBH_WinDBContext()) { db.PhieuHdChiTiets.Add(obj); db.SaveChanges(); return(obj); } }
public void Update(PhieuHdChiTiet obj) { using (var db = new QLBH_WinDBContext()) { db.PhieuHdChiTiets.Attach(obj); db.Entry(obj).State = EntityState.Modified; db.SaveChanges(); } }
public SpLoai Insert(SpLoai obj) { using (var db = new QLBH_WinDBContext()) { db.SpLoais.Add(obj); db.SaveChanges(); return(obj); } }
public void Update(SpLoai obj) { using (var db = new QLBH_WinDBContext()) { db.SpLoais.Attach(obj); db.Entry(obj).State = EntityState.Modified; db.SaveChanges(); } }
public Ncc Insert(Ncc obj) { using (var db = new QLBH_WinDBContext()) { db.Nccs.Add(obj); db.SaveChanges(); return(obj); } }
public void Delete(SpLoai obj) { using (var db = new QLBH_WinDBContext()) { db.SpLoais.Attach(obj); db.SpLoais.Remove(obj); db.SaveChanges(); } }
public GioHang Insert(GioHang obj) { using (var db = new QLBH_WinDBContext()) { db.GioHangs.Add(obj); db.SaveChanges(); return(obj); } }
public Kh Insert(Kh obj) { using (var db = new QLBH_WinDBContext()) { db.Khs.Add(obj); db.SaveChanges(); return(obj); } }
public bool Edit(int mancc, string tenncc) { var edit = new Ncc(); using (var db = new QLBH_WinDBContext()) { edit = db.Nccs.Where(p => p.MaNcc.Equals(mancc)).SingleOrDefault(); edit.TenNcc = tenncc; db.Nccs.Attach(edit); db.Entry(edit).State = EntityState.Modified; db.SaveChanges(); } return(false); }
public bool Them(string tenncc) { var them = new Ncc(); using (var db = new QLBH_WinDBContext()) { try { them.TenNcc = tenncc; db.Nccs.Add(them); db.SaveChanges(); } catch { return(true); } } return(false); }
public bool Delete(int mancc) { var del = new Ncc(); var data = new DataGridView(); using (var db = new QLBH_WinDBContext()) { try { del = db.Nccs.Where(p => p.MaNcc.Equals(mancc)).SingleOrDefault(); db.Nccs.Attach(del); db.Nccs.Remove(del); db.SaveChanges(); } catch { return(true); } } return(false); }