Example #1
0
        public List <User_Post> GetAllFollowedPostByPostId(int postId)
        {
            List <User_Post> user_Posts = new List <User_Post>();
            var followed_post_ids       = db.Followed_Posts.Where(x => x.Main_Post_Id == postId).ToList().OrderByDescending(x => x.Order).Select(x => x.Followed_Post_Id).ToList();

            foreach (var followed_post_id in followed_post_ids)
            {
                User_Post user_Post = db.All_Posts.Find(followed_post_id);
                user_Posts.Add(user_Post);
            }
            return(user_Posts);
        }
Example #2
0
        public List <User_Post> GetAllPostsByTag(int tag_id)
        {
            var allPostsIds = db.Tag_Of_Post.Where(x => x.TagId == tag_id).ToList().Select(x => x.Post_Id);
            List <User_Post> All_Post_ByTag_Id = new List <User_Post>();

            foreach (var postId in allPostsIds)
            {
                User_Post post = db.All_Posts.Find(postId);
                All_Post_ByTag_Id.Add(post);
            }

            return(All_Post_ByTag_Id);
        }
Example #3
0
 public void Add_Post(User_Post post)
 {
     db.All_Posts.Add(post);
     db.SaveChanges();
 }
Example #4
0
 // All access end points for database methods here..
 public void Add_Post(User_Post post)
 {
     this.dataAccess.Add_Post(post);
 }