Example #1
0
 internal static bool UpdateAuthorName(Author update, string newfirstname, string newlastname)
 {
     try
     {
         update.FirstName      = newfirstname;
         update.LastName       = newlastname;
         _context.Database.Log = Console.WriteLine;
         _context.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Example #2
0
 internal static bool AddAuthor(Author author)
 {
     using (_context = new BooksDB())
     {
         try
         {
             _context.Authors.Add(author);
             _context.Database.Log = Console.WriteLine;
             _context.SaveChanges();
             return(true);
         }
         catch (Exception)
         {
             return(false);
         }
     }
 }