blob: ac6c6cbe28f75a59c6b867122830fc78814b7fed (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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();
}
}
}
}
|