Skip to content

Commit

Permalink
Fixing #149
Browse files Browse the repository at this point in the history
  • Loading branch information
d4nt committed May 7, 2023
1 parent 8fcc5d2 commit 407f731
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Web/Controllers/InvitationsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ public ActionResult Index()
return NotFound("Could not find user");
}

var invites = db.OrganisationInvites.Where(uc => uc.InviteEmail.ToLower() == CurrentUser.Email.ToLower() && uc.AcceptedOn == null && uc.RejectedOn == null);
var invites = db
.OrganisationInvites
.Include(c => c.CreatedBy)
.Where(uc => uc.AcceptedOn == null && uc.RejectedOn == null)
.ToList()
.Where(uc => string.Compare(uc.InviteEmail, CurrentUser.Email, StringComparison.OrdinalIgnoreCase) == 0);

if (invites.Any() == false)
{
Expand All @@ -57,9 +62,7 @@ public ActionResult Index()

List<InvitationViewModel> viewModels = new List<InvitationViewModel>();

foreach(var orgGrp in invites
.Include(c => c.CreatedBy)
.GroupBy(c => c.OrganisationId))
foreach (var orgGrp in invites.GroupBy(c => c.OrganisationId))
{
InvitationViewModel viewModel = new InvitationViewModel
{
Expand Down

0 comments on commit 407f731

Please sign in to comment.