returnawaitconn.QuerySingleAsync<PKSystem>("select systems.* from systems, accounts where accounts.system = system.id and accounts.uid = @Id",new{Id=accountId});
}
publicasyncTask<PKSystem>GetByHid(stringhid){
returnawaitconn.QuerySingleAsync<PKSystem>("select * from systems where systems.hid = @Hid",new{Hid=hid.ToLower()});
}
publicasyncTask<PKSystem>GetByToken(stringtoken){
returnawaitconn.QuerySingleAsync<PKSystem>("select * from systems where token = @Token",new{Token=token});
awaitconn.ExecuteAsync("update systems set name = @Name, description = @Description, tag = @Tag, avatar_url = @AvatarUrl, token = @Token, ui_tz = @UiTz where id = @Id",system);
// QueryFirst, since members can (in rare cases) share names
returnawaitconn.QueryFirstOrDefaultAsync<PKMember>("select * from members where lower(name) = @Name and system = @SystemID",new{Name=name,SystemID=system.Id});
await_connection.ExecuteAsync("insert into messages(mid, channel, member, sender) values(@MessageId, @ChannelId, @MemberId, @SenderId)",new{
MessageId=messageId,
ChannelId=channelId,
MemberId=member.Id,
SenderId=senderId
});
}
publicasyncTask<StoredMessage>Get(ulongid){
return(await_connection.QueryAsync<StoredMessage,PKMember,PKSystem,StoredMessage>("select * from messages, members, systems where mid = @Id and messages.member = members.id and systems.id = members.system",(msg,member,system)=>{