Ejemplo n.º 1
0
        public static User MapWithPasswordHashToEntity(UserDetailModel detailModel)
        {
            var passwordHandler = new PasswordHandler();
            var user            = new User
            {
                Id       = detailModel.Id,
                Name     = detailModel.Name,
                Email    = detailModel.Email,
                Password = passwordHandler.HashPassword(detailModel.Password),
            };

            foreach (var activity in detailModel.Activities)
            {
                user.Activities.Add(ActivityMapper.MapToEntity(activity));
            }
            foreach (var team in detailModel.Teams)
            {
                user.Teams.Add(TeamUserMapper.MapToEntity(team, MapToListModel(user)));
            }

            return(user);
        }
Ejemplo n.º 2
0
        public static User MapToEntity(UserDetailModel detailModel)
        {
            var user = new User
            {
                Id            = detailModel.Id,
                Name          = detailModel.Name,
                Email         = detailModel.Email,
                Password      = detailModel.Password,
                LastLoginTime = detailModel.LastLoginTime
            };

            foreach (var activity in detailModel.Activities)
            {
                user.Activities.Add(ActivityMapper.MapToEntity(activity));
            }

            foreach (var team in detailModel.Teams)
            {
                user.Teams.Add(TeamUserMapper.MapToEntity(team, MapToListModel(user)));
            }

            return(user);
        }