Beispiel #1
0
 internal async static Task <Post> InstanciatePostAsync(JSONRepresentations.Get.Post p, Connection conn)
 {
     return(InstanciatePost(p.id,
                            await User.InstanciateUserAsync(p.from, conn),
                            p.network,
                            p.type,
                            p.meta,
                            p.time,
                            p.@public != null ? p.@public == 1 : false,
                            p.message,
                            p.origid != null ? (await Post.GetPostByIdAsync((int)p.origid, conn)) : null,
                            p.via != null ? await User.InstanciateUserAsync((int)p.via, conn) : null,
                            p.commentcount ?? 0,
                            p.modified ?? -1));
 }
Beispiel #2
0
        /// <summary>
        /// Creates a message and fills the user details
        /// </summary>
        /// <param name="content"></param>
        /// <param name="timestamp"></param>
        /// <param name="userid"></param>
        /// <param name="conn"></param>
        /// <returns></returns>
        internal static async Task <Message> CreateMessageAsync(string content, long timestamp, int userid, Connection conn)
        {
            User conversationPartner = await User.InstanciateUserAsync(userid, conn);

            return(new Message(content, timestamp, conversationPartner));
        }