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);
    }
 public Party GetById(int id)
 {
     return(repository.GetById(id));
 }
Example #3
0
 public Party GetParty(int partyId)
 {
     return(PartyRepository.GetById(partyId));
 }