Exemplo n.º 1
0
        public async Task <ActionResult> Get(string ssn)
        {
            Person result = await _personsWrapper.GetPerson(ssn);

            if (result == null)
            {
                return(BadRequest());
            }

            return(Ok(result));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> Get([FromBody] string ssn)
        {
            Person result = await _personsWrapper.GetPerson(ssn);

            if (result == null)
            {
                return(NotFound());
            }

            return(Ok(result));
        }
Exemplo n.º 3
0
        private async Task AddPersonOrOrganization(Party party)
        {
            if (party is null)
            {
                return;
            }

            switch (party.PartyTypeName)
            {
            case PartyType.Person:
                party.Person = await _personService.GetPerson(party.SSN);

                break;

            case PartyType.Organisation:
                party.Organization = await _organizationService.GetOrganization(party.OrgNumber);

                break;
            }
        }
Exemplo n.º 4
0
        /// <inheritdoc />
        public async Task<Party> GetParty(int partyId)
        {
            Party party = null;
            string path = this._localPlatformSettings.LocalTestingStaticTestDataPath + "Register/Party/" + partyId + ".json";
            if (File.Exists(path))
            {
                string content = File.ReadAllText(path);
                party = (Party)JsonConvert.DeserializeObject(content, typeof(Party));
            }


            if (party.PartyTypeName.Equals(PartyType.Person))
            {
                party.Person = await _personService.GetPerson(party.SSN);
            }
            else if (party.PartyTypeName.Equals(PartyType.Organisation))
            {
                party.Organization = await _organizationService.GetOrganization(party.OrgNumber);
            }
            return party;
        }