public void DeletePresidente(ModPresidente c) { p = new PerPresidente(); List <ModPresidente> cs = p.Open(); ModPresidente r = cs.Where(x => x.Id == c.Id).Single(); cs.Remove(r); p.Save(cs); }
public void InsertPresidente(ModPresidente x) { p = new PerPresidente(); List <ModPresidente> cs = p.Open(); int id = 1; if (cs.Count > 0) { id = cs.Max(c => c.Id) + 1; } x.Id = id; cs.Add(x); p.Save(cs); }
public void UpdatePresidente(ModPresidente x) { p = new PerPresidente(); List <ModPresidente> up = p.Open(); for (int i = 0; i < up.Count; i++) { if (up[i].Id == x.Id) { up.RemoveAt(i); break; } } up.Add(x); p.Save(up); }