public RemoveResult Remove(int id) { int result = 0; Chart chart; using (ConnContext db = new ConnContext()) { chart = GetChartById(id); if (chart == null) { result = -1; return((RemoveResult)result); } if (db.KBProjects.SingleOrDefault(k => k.CId == id) != null) { result = -2; return((RemoveResult)result); } db.Charts.Remove(chart); result = db.SaveChanges(); } return((RemoveResult)result); }
public void Salvar(Pagina pagina) { conn.Pagina.Add(pagina); conn.SaveChanges(); }