Exemplo n.º 1
0
        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()));
        }
Exemplo n.º 2
0
        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);
        }