Exemple #1
0
 private List <InterestEntity> GetInterests(int userId)
 {
     return(new List <InterestEntity>()
     {
         InterestEntity.Create(1, userId, "interest1"),
         InterestEntity.Create(2, userId, "interest2")
     });
 }
        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);
        }
Exemple #3
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 static List <InterestEntity> Map(this List <InterestDto> interests, int userId)
 {
     return(interests.Select(a
                             => InterestEntity.Create(a.Id, userId, a.Interest)).ToList());
 }
 public static InterestEntity UpdateId(InterestEntity entity, int id) =>
 new InterestEntity(id, entity.UserId, entity.Description);
 public Task <Result <List <InterestEntity> > > InsertInterests(List <InterestEntity> interests)
 => interests.Select(a => InterestEntity.Create(a.Id, a.UserId, a.Description)).ToList().Success().Async();