Ambiguity list update.

This commit is contained in:
Michael 2017-04-06 21:55:52 -04:00
parent e8b18cbf92
commit 7bc9017b0f
2 changed files with 20 additions and 1 deletions

View file

@ -99,7 +99,14 @@ public WikiPage[] AmbiguousReferences
{
var db = new ApplicationDbContext();
return db.WikiPages.Where(w => w.Id != this.Id && w.Name.ToLower().Contains(this.Name.ToLower())).ToArray();
var ambiguous1 = db.WikiPages.Where(w => w.Id != this.Id && w.Name.ToLower().Contains(this.Name.ToLower())).ToArray();
var ambiguous2 = db.WikiPages.Where(w => w.Id != this.Id && this.Name.ToLower().Contains(w.Name.ToLower())).ToArray();
var list = new List<WikiPage>();
list.AddRange(ambiguous1);
list.AddRange(ambiguous2);
return list.ToArray();
}
}

View file

@ -56,6 +56,18 @@
{
<h1>@Model.Page.Name</h1>
if(Model.Page.AmbiguousReferences.Length > 0)
{
<p>Ambiguity detected. Here's a list of pages that may relate to this page.</p>
<ul>
@foreach(var page in Model.Page.AmbiguousReferences)
{
<li>@Html.ActionLink(page.Name, "Index", new { id = page.Id })</li>
}
</ul>
}
var edit = Model.Page.EditHistory.First();
<p><strong>Last edited by @Html.UserLink(edit.UserId) on @edit.EditedAt</strong></p>