public void Post(GuestBookEntry entry) { try { db.GetCollection<GuestBookEntry>(collectionName).InsertOneAsync(entry).Wait(); } catch (Exception ex) { throw new GuestbookException("Failed to post to guest book", ex); } }
static void MakeEntry(IGuestBook guestbook) { var entry = new GuestBookEntry(); Console.Write("enter name: "); entry.Name = Console.ReadLine(); Console.Write("enter message: "); entry.Message = Console.ReadLine(); guestbook.Post(entry); Console.Clear(); }