public bool Insert(PHONG item) { try { using (var db = new QLPhongKaraokeEntities()) { db.PHONGs.Add(item); db.SaveChanges(); } return(true); } catch (Exception) { return(false); } }
public bool Update(PHONG item) { try { using (var db = new QLPhongKaraokeEntities()) { var x = from s in db.PHONGs where s.ID == item.ID && s.Deleted == 0 select s; var sv = x.FirstOrDefault(); if (sv != null) { sv.Ten = item.Ten; sv.IdLoaiPhong = item.IdLoaiPhong; db.SaveChanges(); } } return(true); } catch (Exception) { return(false); } }