Esempio n. 1
0
 public int CreateAuthor(Author newAuthor)
 {
     modelContainer.Authors.Add(newAuthor);
     return modelContainer.DbSaveChanges();
 }
Esempio n. 2
0
 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;
 }