public void UpdateBuku() { appContext = new AppContext(); Buku bukuBaru = new Buku(); bukuBaru = appContext.buku.Where(f => f.id == "1").FirstOrDefault(); bukuBaru.judul = "Laskar Pelangi 2"; appContext.Update(bukuBaru); appContext.SaveChanges(); }
public void DeleteBuku() { appContext = new AppContext(); Buku buku = new Buku(); buku = appContext.buku.Where(f => f.id == "99").FirstOrDefault(); if (buku != null) { appContext.Remove(buku); appContext.SaveChanges(); } }