public int CreateAuthor(Author newAuthor) { modelContainer.Authors.Add(newAuthor); return modelContainer.DbSaveChanges(); }
public int EditAuthor(Author newAuthor) { Author Author = modelContainer.Authors.FirstOrDefault(b => b.Id == newAuthor.Id); if (Author != null) { Author.FirstName = newAuthor.FirstName; Author.LastName = newAuthor.LastName; return modelContainer.DbSaveChanges(); } return 0; }