Beispiel #1
0
 public static IEnumerable<Message> GetMessages(Room room)
 {
     var messages = DapperUtil.Query<Message>(@"
         SELECT
             RoomId
             ,PostTime
             ,Number
             ,Name
             ,Comment
             ,IsAuth
             ,IsBan
             ,ListenerId
         FROM
             Message
         WHERE
             RoomId = @RoomId
         ORDER BY
             Order
         ;
     ", room);
     return messages;
 }
Beispiel #2
0
        public static void UpdateRoom(Room room)
        {
            DapperUtil.Execute(executor => {
                var transaction = executor.BeginTransaction();

                executor.Execute(@"
                    INSERT OR REPLACE INTO Room (
                        RoomId
                        ,Author
                        ,Title
                        ,Description
                        ,Tags
                        ,IdVisible
                        ,AnonymousOnly
                        ,StartTime
                        ,ListenerCount
                    ) VALUES (
                        @RoomId, @Author, @Title, @Description, @Tags, @IdVisible, @AnonymousOnly, @StartTime, @ListenerCount
                    );
                ", room, transaction);

                transaction.Commit();
            });
        }