summaryrefslogtreecommitdiff
path: root/Project-Unite/Models
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-03-27 18:57:07 -0400
committerMichael <[email protected]>2017-03-27 18:57:07 -0400
commit1dcbadf2eb928c63ce3a968f311f6af6b81d33a4 (patch)
tree53491bbdee3e5d77059f810541441ff585c96d0e /Project-Unite/Models
parent7111f0d5cd4123287d2510d77350d849afe7ea98 (diff)
downloadproject-unite-1dcbadf2eb928c63ce3a968f311f6af6b81d33a4.tar.gz
project-unite-1dcbadf2eb928c63ce3a968f311f6af6b81d33a4.tar.bz2
project-unite-1dcbadf2eb928c63ce3a968f311f6af6b81d33a4.zip
Beginning of wiki development
Diffstat (limited to 'Project-Unite/Models')
-rw-r--r--Project-Unite/Models/IdentityModels.cs3
-rw-r--r--Project-Unite/Models/WikiModels.cs69
2 files changed, 72 insertions, 0 deletions
diff --git a/Project-Unite/Models/IdentityModels.cs b/Project-Unite/Models/IdentityModels.cs
index 5ec480f..cf04def 100644
--- a/Project-Unite/Models/IdentityModels.cs
+++ b/Project-Unite/Models/IdentityModels.cs
@@ -204,6 +204,9 @@ namespace Project_Unite.Models
}
+ public DbSet<WikiPage> WikiPages { get; set; }
+ public DbSet<WikiCategory> WikiCategories { get; set; }
+
public void DeleteObject(object obj)
{
((IObjectContextAdapter)this).ObjectContext.DeleteObject(obj);
diff --git a/Project-Unite/Models/WikiModels.cs b/Project-Unite/Models/WikiModels.cs
new file mode 100644
index 0000000..ac6c6cb
--- /dev/null
+++ b/Project-Unite/Models/WikiModels.cs
@@ -0,0 +1,69 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace Project_Unite.Models
+{
+ public class WikiCategory
+ {
+ public string Id { get; set; }
+ public string Name { get; set; }
+ public string Parent { get; set; }
+
+ public WikiCategory[] Children
+ {
+ get
+ {
+ var db = new ApplicationDbContext();
+
+ return db.WikiCategories.Where(x => x.Parent == this.Id).ToArray();
+ }
+ }
+
+ public WikiPage[] Pages
+ {
+ get
+ {
+ var db = new ApplicationDbContext();
+
+ return db.WikiPages.Where(w => w.CategoryId == this.Id).ToArray();
+ }
+ }
+ }
+
+ public class WikiViewModel
+ {
+ public IEnumerable<WikiCategory> Categories { get; set; }
+ public WikiPage Page { get; set; }
+ }
+
+ public class WikiPage
+ {
+ public string Id { get; set; }
+ public string Name { get; set; }
+ public string CategoryId { get; set; }
+
+ //I stole this feature from wikipedia lol. I like the idea of disambiguation of multiple pages with the same name.
+ public WikiPage[] AmbiguousReferences
+ {
+ get
+ {
+ var db = new ApplicationDbContext();
+
+ return db.WikiPages.Where(w => w.Id != this.Id && w.Name.ToLower().Contains(this.Name.ToLower())).ToArray();
+ }
+ }
+
+ public string Contents { get; set; }
+
+ public ForumPostEdit[] EditHistory
+ {
+ get
+ {
+ var db = new ApplicationDbContext();
+ return db.ForumPostEdits.Where(x => x.Parent == this.Id).ToArray();
+ }
+ }
+ }
+} \ No newline at end of file