public async Task <ServicesResult> CreateRelative(int id, DragonBallPostRelativeRequest request)
        {
            var entity = new FamilyEntity(request)
            {
                CharacterID = id
            };

            var result = await _familyRepository.CreateAsync(entity, true);

            return(Created(result));
        }
Esempio n. 2
0
        public async Task <IActionResult> PostFamilyAsync([FromBody] CreateFamilyRequest request)
        {
            var kinships = new List <Kinship>();
            var family   = _mapper.Map <Domain.Entities.Family>(request);

            foreach (var kinship in request.Kinships)
            {
                kinships.Add(new Kinship(kinship.Description, kinship.PersonName, family.Id));
            }

            family.AddKinships(kinships);
            await _familyRepository.CreateAsync(family);

            return(Ok());
        }