示例#1
0
        public static void ViewAccountPosts()
        {
            var user = new UserPoco {
                Name = Account.Name, Password = Account.Password, UserId = Account.Id
            };

            using (var conn = new NpgsqlConnection(ConnectionString))
            {
                var database = new Database(conn);
                var service  = new Service(database);
                var posts    = service.GetAllUsersPosts(user);

                if (posts.Count > 0)
                {
                    var choosedPost = Post.ChoosePostInterface(posts);

                    if (choosedPost != null)
                    {
                        ChoosePost(choosedPost);
                    }
                }
                else
                {
                    Console.WriteLine(
                        "You don't have any posts yet! create your first post by typing 'post-create' !\n");
                }
            }
        }
示例#2
0
        public static void ShowLatests()
        {
            using (var conn = new NpgsqlConnection(ConnectionString))
            {
                conn.Open();

                var database = new Database(conn);
                var service  = new Service(database);
                var posts    = service.GetNewestsPosts();

                var choosedPost = Post.ChoosePostInterface(posts);
                if (choosedPost != null)
                {
                    ChoosePost(choosedPost);
                }
            }
        }