Пример #1
0
 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);
     }
 }
Пример #2
0
        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();
        }