public async Task <ActionResult <FamilyTreeDto> > PostFamilyTree(FamilyTreeDto dataDto)
        {
            var data   = _mapper.MapFromDto <FamilyTreeDto, Entity.FamilyTree>(dataDto);
            var result = await _service.CreateFamilyTreeAsync(data);

            return(new ObjectResult(new
            {
                FamilyTreeCreate = _mapper.MapToDto <Entity.FamilyTree, FamilyTreeDto>(result)
            }));
        }
示例#2
0
        public async Task <ActionResult <IEnumerable <PersonDto> > > GetSimiliarPersons([FromBody] PersonDto dataDto)
        {
            var data = _mapper.MapFromDto <PersonDto, Person>(dataDto);

            var result = await _service.GetSimiliarPersonsAsync(data);

            return(new ObjectResult(new
            {
                PersonsGetSimiliar = _mapper.MapToDto <Person, PersonDto>(result)
            }));
        }
示例#3
0
        public async Task <ActionResult <UserCompleteDto> > LoginUser([FromBody] LoginCredentialsDto dataDto)
        {
            var data = _mapper.MapFromDto <LoginCredentialsDto, User>(dataDto);

            var result = await _service.LoginUserAsync(data);

            if (result == null)
            {
                return(BadRequest(new { message = "Username or password is incorrect" }));
            }

            return(new ObjectResult(new
            {
                Login = _mapper.MapToDto <User, LoginCredentialsDto>(result)
            }));
        }
示例#4
0
        public async Task <ActionResult <MarriageDto> > CreateMarriage(MarriageDto dataDto, int familytreeId)
        {
            var data = _mapper.MapFromDto <MarriageDto, Marriage>(dataDto);

            var result = await _service.AddMarriageToRelationshipAsync(data, familytreeId);

            return(new ObjectResult(new
            {
                MarriageCreate = _mapper.MapToDto <Marriage, MarriageDto>(result)
            }));
        }