コード例 #1
0
    public bool RegisterPersonToParty(int personId, int partyId)
    {
        Person person = personRepository.GetById(personId);
        Party  party  = partyRepository.GetById(partyId);

        // invalid person or party id
        if (person == null || party == null)
        {
            return(false);
        }

        if (registrationRepository.GetByPerson(person) != null)
        {
            // person has registration
            return(false);
        }

        // person has no registration yet
        var registration = new Registration(person, party);

        registrationRepository.Save(registration);

        return(true);
    }