public void CreateClub_ValidMapping()
        {
            var newPerson = new CreatePersonModel()
            {
                ClubId = 1, LastName = "T", FirstName = "T"
            };

            var person = CreatePersonModel.ToPerson(newPerson);

            person.ClubId.ShouldBe(newPerson.ClubId);
            person.FirstName.ShouldBe(newPerson.FirstName);
            person.LastName.ShouldBe(newPerson.LastName);
        }
Пример #2
0
        public async Task <Person> Create(CreatePersonModel newPerson)
        {
            var club = await _clubRepository.GetByIdAsync(newPerson.ClubId);

            if (club == null)
            {
                return(null);
            }

            var person = CreatePersonModel.ToPerson(newPerson);

            club.AddPerson(person);

            await _clubRepository.UpdateAndSaveAsync(club);

            return(person);
        }