public bool Update([FromBody] Librarycard librarycard) { db.Librarycard.Update(librarycard); bool isSaved = db.SaveChanges(true) != 0; return(isSaved); }
public bool Post([FromBody] Librarycard librarycard) { db.Librarycard.Add(librarycard); bool isSaved = db.SaveChanges(true) != 0; return(isSaved); }
public bool Delete(int?id) { bool isDeleted = false; if (id != null) { Librarycard librarycard = db.Librarycard.FirstOrDefault(a => a.Id == id); if (librarycard != null) { db.Librarycard.Remove(librarycard); isDeleted = db.SaveChanges(true) != 0; } } return(isDeleted); }