コード例 #1
0
ファイル: PostsModels.cs プロジェクト: robiboi/blurt.ph
        public void CreatePost()
        {
            MensaheRepository mr = new MensaheRepository();
            TagIyaRepository tir = new TagIyaRepository();
            try
            {
                Mensahe msg = new Mensahe();
                msg.Message = this.Message;
                msg.DatePosted = DateTime.Now;
                msg.DateEdited = DateTime.Now;

                mr.InsertMessage(msg, tir.GetTagIya(this.PostUserId));
            }
            catch
            {
                throw;
            }
        }
コード例 #2
0
ファイル: PostsModels.cs プロジェクト: robiboi/blurt.ph
        /// <summary>
        /// Get posts by User
        /// </summary>
        /// <param name="UserId">User Id</param>
        /// <returns></returns>
        public static List<PostsModels> GetPostsByUser(int UserId)
        {
            MensaheRepository mr = new MensaheRepository();
            TagIyaRepository tir = new TagIyaRepository();

            try
            {
                var msgs = mr.GetUserMessages(UserId);
                var tagIya = tir.GetTagIya(UserId);

                List<PostsModels> posts = new List<PostsModels>();
                foreach (Mensahe msg in msgs)
                {
                    PostsModels post = new PostsModels();
                    post = post.GetPostsModel(tagIya, msg);
                    posts.Add(post);
                }
                return posts;
            }
            catch
            {
                throw;
            }
        }