public IList <LeaveRequestWithNames> Supervisor() { var groupId = User.LeaveDelegateGroupId() ?? User.SupervisorGroupId() ?? throw new UnauthorizedAccessException( "Logged in user must be a supervisor or leave delegate"); return(_leaveService.ListUnderOrgGroup(groupId, User.PersonId())); }
public IList <PersonAndLeaveDetails> MyPeopleWithLeave(int year) { var groupId = User.LeaveDelegateGroupId() ?? User.SupervisorGroupId() ?? throw new UnauthorizedAccessException( "Logged in user must be a supervisor or leave delegate"); var people = _leaveService.PeopleInGroupWithLeave(groupId, year); var personId = User.PersonId(); if (personId != null && people.All(details => details.Person.Id != personId)) { people.Insert(0, _leaveService.PersonWithLeave(personId.Value, year)); } return(people); }