示例#1
0
        public async Task <RoomHistory> SaveRoomHistory(Room room, int userId)
        {
            var roomHistory = new RoomHistory {
                RoomId   = room.Id,
                WaiterId = userId,
                Name     = room.Name,
                Status   = room.Status,
                CreateAt = DateTimeOffset.UtcNow.ToUnixTimeSeconds(),
            };

            using (var conn = Connection)
            {
                conn.Open();
                await conn.InsertAsync(roomHistory);
            }

            return(roomHistory);
        }
        private async Task <RoomHistory> NewRoomHistory(Room room, int userId)
        {
            var roomHistory = new RoomHistory
            {
                RoomId   = room.Id,
                WaiterId = userId,
                Name     = room.Name,
                Status   = room.Status,
                CreateAt = GetTime(),
            };

            using (var conn = Connection)
            {
                conn.Open();
                await conn.InsertAsync(roomHistory);
            }

            return(roomHistory);
        }