Exemple #1
0
        public IActionResult GetPersonForAgency(long id, [Required, NotNull] string agencySystemName)
        {
            var agency = IdentityRepository.GetAgency(agencySystemName);

            if (agency == null)
            {
                ModelState.AddModelError(nameof(agencySystemName), $"{agencySystemName} was not found");
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            Debug.Assert(agency != null, nameof(agency) + " != null");

            var personIdentity = new PersonIdentity(id);

            if (!IdentityRepository
                .GetPeopleWithIdentifiers(new[] { personIdentity }, agency.RootIdentifierNames(), UserProvider)
                .TryGetValue(personIdentity, out var identifiers))
            {
                return(NotFound(id));
            }

            var personIdForAgency = IdentityRepository.GetPersonAgencyId(personIdentity, agency.Id);

            return(Ok(new AgencyPersonDto(personIdForAgency, IdentifierDtoMarshaller.MarshallToDtos(identifiers))));
        }
Exemple #2
0
 public IActionResult GetPerson(long id)
 {
     return(Ok(IdentifierDtoMarshaller.MarshallToDtos(IdentityRepository.GetPersonIdentifiers(id))));
 }