diff --git a/ProjectLighthouse/Pages/Partials/PhotoPartial.cshtml b/ProjectLighthouse/Pages/Partials/PhotoPartial.cshtml new file mode 100644 index 00000000..33a8fbc1 --- /dev/null +++ b/ProjectLighthouse/Pages/Partials/PhotoPartial.cshtml @@ -0,0 +1,22 @@ +@using LBPUnion.ProjectLighthouse.Types +@model LBPUnion.ProjectLighthouse.Types.Photo + + +
+ +

+ + Taken by + + @Model.Creator?.Username + + +

+ +

+ Photo contains @Model.Subjects.Count @(Model.Subjects.Count == 1 ? "person" : "people"): +

+@foreach (PhotoSubject subject in Model.Subjects) +{ + @subject.User.Username +} \ No newline at end of file diff --git a/ProjectLighthouse/Pages/PhotosPage.cshtml b/ProjectLighthouse/Pages/PhotosPage.cshtml index 844165ca..e579cbc3 100644 --- a/ProjectLighthouse/Pages/PhotosPage.cshtml +++ b/ProjectLighthouse/Pages/PhotosPage.cshtml @@ -12,25 +12,7 @@ @foreach (Photo photo in Model.Photos) {
- -
- -

- - Taken by - - @photo.Creator.Username - - -

- -

- Photo contains @photo.Subjects.Count @(photo.Subjects.Count == 1 ? "person" : "people"): -

- @foreach (PhotoSubject subject in photo.Subjects) - { - @subject.User.Username - } + @await Html.PartialAsync("Partials/PhotoPartial", photo)
} diff --git a/ProjectLighthouse/Pages/UserPage.cshtml b/ProjectLighthouse/Pages/UserPage.cshtml index d23cc01c..68317395 100644 --- a/ProjectLighthouse/Pages/UserPage.cshtml +++ b/ProjectLighthouse/Pages/UserPage.cshtml @@ -6,7 +6,7 @@ @{ Layout = "Layouts/BaseLayout"; - Model.Title = "Model.ProfileUser!.Username's user page"; + Model.Title = Model.ProfileUser!.Username + "'s user page"; Model.ShowTitleInPage = false; } @@ -14,7 +14,7 @@

@Model.Title

- @Model.ProfileUser.Status + @Model.ProfileUser!.Status

@Model.ProfileUser.Hearts @@ -74,16 +74,7 @@ @foreach (Photo photo in Model.Photos) {
- -
- -

- Photo contains @photo.Subjects.Count @(photo.Subjects.Count == 1 ? "person" : "people"): -

- @foreach (PhotoSubject subject in photo.Subjects) - { - @subject.User.Username - } + @await Html.PartialAsync("Partials/PhotoPartial", photo);
}