Esempio n. 1
0
        public static ForumData GetInstance()
        {
            if (instance is null)
            {
                instance = new ForumData();
            }

            return(instance);
        }
Esempio n. 2
0
        public void Dispose()
        {
            this.SaveChanges();

            this.Categories = null;
            this.Users      = null;
            this.Posts      = null;
            this.Replies    = null;
            instance        = null;
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            var forumData = new ForumData();

            forumData.Users.Add(new User(1, "gg", "fff", new List <int>()
            {
                1, 2, 3
            }));
            forumData.SaveChenges();
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            var forumData = new ForumData();

            forumData.Users.Add(new User(1, "firstUser", "firstPassword", new List <int> {
                1, 2, 3, 4
            }));
            forumData.Categories.Add(new Category(1, "firstUser", new List <int> {
                1, 2, 3, 4
            }));
            forumData.Posts.Add(new Post(1, "post1", "post1 content", 1, 2, new List <int> {
                1, 2, 3, 4, 5
            }));
            forumData.Replies.Add(new Reply(1, "reply1 content", 2, 3));
            forumData.SaveChanges();
        }
        static void Main(string[] args)
        {
            var forumData = new ForumData();

            forumData.Users.Add(new User(1, "firtUser", "firstpass", new List <int> {
                1, 2
            }));
            forumData.Categories.Add(new Category(1, "Category1", new List <int> {
                1
            }));
            forumData.Posts.Add(new Post(1, "post1", "post 1 contrent", 1, 2, new List <int> {
                1, 2, 3
            }));
            forumData.Replies.Add(new Reply(1, "reply1", 1, 1));
            forumData.SaveChanges();
        }
        static void Main(string[] args)
        {
            ForumData forumData = new ForumData();

            foreach (var category in forumData.Categories)
            {
                Console.WriteLine(category.Name);
            }
            foreach (var post in forumData.Posts)
            {
                Console.WriteLine(post.Content);
            }
            foreach (var user in forumData.Users)
            {
                Console.WriteLine(user.Password);
            }
            foreach (var reply in forumData.Replies)
            {
                Console.WriteLine(reply.Content);
            }
            forumData.SaveChanges();
        }
Esempio n. 7
0
 static void Main(string[] args)
 {
     ForumData forumData = new ForumData();
 }