Example #1
0
 public void SaveGuestBookMessage(GuestBookMessage guestBookMessage)
 {
     using (var en = new antmatEntities())
     {
         en.GuestBookMessages.Add(new Entity.GuestBookMessage
                                      {
                                          CreateDate = DateTime.Now,
                                          Message = guestBookMessage.Message,
                                          Name = guestBookMessage.Name
                                      });
         en.SaveChanges();
     }
 }
Example #2
0
        public ICollection<GuestBookMessage> GetGuestBookMessages()
        {
            var messages = new Collection<GuestBookMessage>();

            using (var en = new Entity.antmatEntities())
            {
                foreach (var guestBookMessage in en.GuestBookMessages)
                {
                    messages.Add(new GuestBookMessage
                                     {
                                         Message = guestBookMessage.Message,
                                         Name = guestBookMessage.Name,
                                         Date = guestBookMessage.CreateDate
                                     });
                }
            }

            return messages;
        }