private void chinhsuadn(LyLichXinViec _l1xivc) { using (var db1 = new TroGiupViecLamEntities()) { db1.Entry(_l1xivc).State = System.Data.Entity.EntityState.Modified; db1.SaveChanges(); } }
private bool capnhatcv(LyLichXinViec _ll23xv) { try { using (var db1 = new TroGiupViecLamEntities()) { // db1.Entry(_ll23xv).State =EntityState.Modified; string mavc = dgrDSLL.SelectedRows[0].Cells[0].Value.ToString(); // db1.LyLichXinViecs.Attach(); db1.Entry(_ll23xv).State = _ll23xv.maCV == mavc ? EntityState.Added : EntityState.Modified; db1.SaveChanges(); return(true); } } catch (Exception) { return(false); } }