Skip to content

Commit

Permalink
Added admin actions to view model and get all reports request. Is opt…
Browse files Browse the repository at this point in the history
…ional, so only used in specific cases on the frontend.
  • Loading branch information
Centerville1 committed Nov 29, 2024
1 parent e2cf25e commit d387963
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
4 changes: 4 additions & 0 deletions Gordon360/Documentation/Gordon360.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions Gordon360/Models/ViewModels/MissingItemReportViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Gordon360.Models.CCT;
using System;
using System;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;

namespace Gordon360.Models.ViewModels
{
Expand Down Expand Up @@ -44,6 +43,8 @@ public class MissingItemReportViewModel

public bool forGuest { get; set; }

public IEnumerable<ActionsTakenViewModel>? adminActions { get; set; }

public static implicit operator MissingItemReportViewModel(CCT.MissingItemData MissingReportDBModel) => new MissingItemReportViewModel
{
recordID = MissingReportDBModel.ID,
Expand Down
15 changes: 14 additions & 1 deletion Gordon360/Services/LostAndFoundService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,20 @@ public IEnumerable<MissingItemReportViewModel> GetMissingItems(string username)
public IEnumerable<MissingItemReportViewModel> GetMissingItemsAll()
{
IEnumerable<MissingItemData> missingList = context.MissingItemData.AsEnumerable();
return missingList.Select(x => (MissingItemReportViewModel)x);
IEnumerable<MissingItemReportViewModel>missingModelList = missingList.Select(x => (MissingItemReportViewModel)x);
List<IEnumerable<ActionsTakenViewModel>> actionsTakenList = [];
foreach (MissingItemReportViewModel item in missingModelList)
{
if (item.recordID != null)
{
actionsTakenList.Add(GetActionsTaken((int)item.recordID));
}
}

IEnumerator<IEnumerable<ActionsTakenViewModel>> actionsTakenEnumerator = actionsTakenList.GetEnumerator();

missingModelList = missingModelList.Select(x => { actionsTakenEnumerator.MoveNext(); x.adminActions = actionsTakenEnumerator.Current; return x; });
return missingModelList;
}

/// <summary>
Expand Down

0 comments on commit d387963

Please sign in to comment.