示例#1
0
        public void Create(Message message)
        {
            using (var uow = _db.GetTransaction())
            {
                _db.Insert(message);

                foreach (var sig in message.Attributions)
                {
                    _db.Insert(new MessageAttribution(message.Id, sig.Id));
                }

                uow.Complete();
            }
        }
 public void Create(Models.Rsvp rsvp)
 {
     using (var uow = _db.GetTransaction())
     {
         _db.Insert(rsvp);
         foreach (var response in rsvp.Responses)
         {
             _db.Insert(response);
         }
         _db.Execute(@"UPDATE core.Guests 
                         SET HasSentRsvp = 1 
                         WHERE Id IN (@0)",
                     rsvp.Responses.Select(x => x.GuestId));
         uow.Complete();
     }
 }
 public virtual void Create(IEnumerable <T> entity)
 {
     using (var uow = _db.GetTransaction())
     {
         foreach (var e in entity)
         {
             _db.Insert(e);
         }
         uow.Complete();
     }
 }
示例#4
0
 public void Create(IEnumerable <T> events, Guid userId)
 {
     using (var uow = _db.GetTransaction())
     {
         foreach (var e in events)
         {
             _db.Insert(e);
             _db.Execute(@"INSERT INTO core.UserEventMapping (Id, UserId, EventId) VALUES
                          (@0, @1, @2)"
                         , Guid.NewGuid().ToString()
                         , userId.ToString()
                         , e.Id);
         }
         uow.Complete();
     }
 }