/// <summary> /// Initializes a new instance of the <see cref="ForumThread"/> class. /// </summary> /// <param name="id">id used to identify this thread</param> /// <param name="posts">posts this thread holds</param> /// <param name="category">category this thread is part of</param> /// <param name="name">name of this thread</param> /// <param name="username">username of the person that posted this thread</param> public ForumThread(int id, List<Post> posts, ForumCategory category, string name, string username) { this.ID = id; this.Posts = posts; this.Category = category; this.Name = name; this.Username = username; }
/// <summary> /// Initializes a new instance of the <see cref="ForumCategory"/> class. /// </summary> /// <param name="id">used to identify the category</param> /// <param name="parentCategory">the parent of this category</param> /// <param name="name">Name of this category</param> public ForumCategory(int id, ForumCategory parentCategory, string name) { this.ID = id; this.ParentCategory = parentCategory; this.Name = name; }
/// <summary> /// Creates a new thread /// </summary> /// <param name="user"> User that posted this thread</param> /// <param name="content">content of the first post</param> /// <param name="category">category this thread belongs to</param> /// <param name="threadName">name of this thread</param> public static void CreateNewThread(User user, string content, ForumCategory category, string threadName) { DatabaseManager.CreateNewThread(user.Username, category.ID, content, threadName); }
/// <summary> /// counts the number of threads in a given category /// </summary> /// <param name="category">is used to identify what category you want</param> /// <returns>The number of posts that belong to the given category</returns> public static int NumberofThreadsPerCategory(ForumCategory category) { return Threads.FindAll(x => x.Category.ID == category.ID).Count; }