public void Update(DemoTable fdata) { DemoTable data = new DemoTable(); data = db.DemoTables.FirstOrDefault(x => x.id == fdata.id); data.Name = fdata.Name; data.Address = fdata.Address; db.SaveChanges(); }
public void Delete(int Id = 0) { try { DemoTable data = new DemoTable(); data = db.DemoTables.FirstOrDefault(x => x.id == Id); db.DemoTables.Remove(data); db.SaveChanges(); } catch (Exception) { } }
public void Add(DemoTable fdata) { try { DemoTable data = new DemoTable(); data.Name = fdata.Name; data.Address = fdata.Address; db.DemoTables.Add(data); db.SaveChanges(); } catch (Exception) { } }