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