public static ChiTietSanPham FindCTSach(int id) { ChiTietSanPham b = null; using (var db = new Context()) { b = db.ChiTietSanPham.Find(id); db.Dispose(); } return(b); }
public static ChiTietSanPham UpdateCTSach(int masach, string tenchitiet, string chitiet) { ChiTietSanPham b = null; using (var db = new Context()) { b = db.ChiTietSanPham.Find(masach); b.tenchitiet = tenchitiet; b.chitiet = chitiet; db.Entry(b).State = EntityState.Modified; db.SaveChanges(); db.Dispose(); } return(b); }