From 8de0903ceefcddb0a9ea378a5ee230dfe16fd16b Mon Sep 17 00:00:00 2001 From: jvyden Date: Mon, 31 Jan 2022 00:21:53 -0500 Subject: [PATCH] Include creator in photos db call --- ProjectLighthouse/Pages/PhotosPage.cshtml.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ProjectLighthouse/Pages/PhotosPage.cshtml.cs b/ProjectLighthouse/Pages/PhotosPage.cshtml.cs index b6c6efca..f3e7983f 100644 --- a/ProjectLighthouse/Pages/PhotosPage.cshtml.cs +++ b/ProjectLighthouse/Pages/PhotosPage.cshtml.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using JetBrains.Annotations; -using LBPUnion.ProjectLighthouse.Helpers; using LBPUnion.ProjectLighthouse.Pages.Layouts; using LBPUnion.ProjectLighthouse.Types; using LBPUnion.ProjectLighthouse.Types.Settings; @@ -40,8 +39,9 @@ public class PhotosPage : BaseLayout if (this.PageNumber < 0 || this.PageNumber >= this.PageAmount) return this.Redirect($"/photos/{Math.Clamp(this.PageNumber, 0, this.PageAmount - 1)}"); - this.Photos = await this.Database.Photos.Where - (p => p.Creator.Username.Contains(name) || p.PhotoSubjectCollection.Contains(name)) + this.Photos = await this.Database.Photos.Include + (p => p.Creator) + .Where(p => p.Creator.Username.Contains(name) || p.PhotoSubjectCollection.Contains(name)) .OrderByDescending(p => p.Timestamp) .Skip(pageNumber * ServerStatics.PageSize) .Take(ServerStatics.PageSize)