public int Create(RPT_Menu data) { using (ReportEntities db = new ReportEntities()) { db.RPT_Menu.Add(data); return(db.SaveChanges()); } }
public int Update(RPT_Menu data) { using (ReportEntities db = new ReportEntities()) { var exsit = db.RPT_Menu.FirstOrDefault(p => p.MenuID == data.MenuID); if (exsit != null) { int id = exsit.ID; exsit.CopyFrom(data); exsit.ID = id; } return(db.SaveChanges()); } }