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); } }
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); } } }