Beispiel #1
0
        public static PersonalProfileEntity Map(this PersonalProfileDto profileDto, int userId, IDataProtector protector)
        {
            string encriptedPhone = protector.Protect(profileDto.Phone);
            string encriptedEmail = protector.Protect(profileDto.Email);

            return(PersonalProfileEntity.Create(userId, profileDto.Id, profileDto.FirstName, profileDto.LastName, profileDto.Description,
                                                encriptedPhone, encriptedEmail, profileDto.Website, profileDto.GitHub));
        }
Beispiel #2
0
 private PersonalProfileEntity GetPersonalProfileEntity(int UserId)
 {
     return(PersonalProfileEntity.Create(UserId, 1,
                                         "firstName",
                                         "LastName",
                                         "Descripción",
                                         _protector.Protect("Telefono"),
                                         _protector.Protect("*****@*****.**"),
                                         "http://www.netmentor.es",
                                         "/ElectNewt"));
 }
        public static (PersonalProfileEntity, List <SkillEntity>, List <InterestEntity>) MapToEntities(this PersonalProfileDto profileDto)
        {
            PersonalProfileEntity personalProfile = PersonalProfileEntity.Create((int)profileDto.UserId, profileDto.Id, profileDto.FirstName, profileDto.LastName, profileDto.Description,
                                                                                 profileDto.Phone, profileDto.Email, profileDto.Website, profileDto.GitHub);

            List <SkillEntity> skills = profileDto.Skills.Select(a => SkillEntity.Create(profileDto.UserId, a.Id, a.Name, a.Punctuation)).ToList();

            List <InterestEntity> interests = profileDto.Interests.Select(a => InterestEntity.Create(a.Id, profileDto.UserId, a.Interest)).ToList();

            return(personalProfile, skills, interests);
        }
Beispiel #4
0
        public static PostPersonalProfileWrapper MapToWraperEntities(this PersonalProfileDto profileDto, IDataProtector protector)
        {
            if (profileDto.UserId == null)
            {
                throw new Exception("Your are trying to build an entity with a null user, that cannot be done");
            }

            string encriptedPhone = protector.Protect(profileDto.Phone);
            string encriptedEmail = protector.Protect(profileDto.Email);

            PersonalProfileEntity personalProfile = PersonalProfileEntity.Create((int)profileDto.UserId, profileDto.Id, profileDto.FirstName, profileDto.LastName, profileDto.Description,
                                                                                 encriptedPhone, encriptedEmail, profileDto.Website, profileDto.GitHub);

            List <SkillEntity> skills = profileDto.Skills.Select(a => SkillEntity.Create(profileDto.UserId, a.Id, a.Name, a.Punctuation)).ToList();

            List <InterestEntity> interests = profileDto.Interests.Select(a => InterestEntity.Create(a.Id, profileDto.UserId, a.Interest)).ToList();

            return(new PostPersonalProfileWrapper(personalProfile, skills, interests));
        }
 public Task <Result <PersonalProfileEntity> > InsertPersonalProfile(PersonalProfileEntity personalProfile)
 => PersonalProfileEntity.Create(personalProfile.UserId, personalProfile.Id, personalProfile.FirstName,
                                 personalProfile.LastName, personalProfile.Description, personalProfile.Phone,
                                 personalProfile.Email, personalProfile.Website, personalProfile.GitHub).Success().Async();