Esempio n. 1
0
 public Comment Convert(Model.Users.Entities.Comment comment)
 {
     var commenter = _repository.Query(m => m.Users.FirstOrDefault(u => u.UserId == comment.UserId));
     _imageProvider = new ImageProvider(commenter);
     return new Comment
                {
                    Text = comment.Text,
                    Created = comment.Created.ToFormattedString(),
                    Comments = comment.Comments != null ? comment.Comments.Select(Convert) : new List<Comment>(),
                    UserImageSrc = _imageProvider.GetProfileImageSrc(),
                    UserDisplayName = commenter != null ? commenter.DisplayName : string.Empty
                };
 }
Esempio n. 2
0
 public Message Convert(Model.Users.AggregateRoots.Message message)
 {
     var from = _repository.Query(m => m.Users.FirstOrDefault(u => u.UserId == message.UserId));
     _imageProvider = new ImageProvider(from);
     return new Message
                {
                    Subject = message.Subject,
                    Text = message.Text,
                    Created = message.Created.ToFormattedString(),
                    ImageSrc = _imageProvider.GetProfileImageSrc(),
                    UserId = message.UserId,
                    DisplayName = from.DisplayName
                };
 }
 public CurrentUser Convert(Model.Users.AggregateRoots.IUser user)
 {
     _imageProvider = new ImageProvider(user);
     return new CurrentUser
                {
                    Active = user.Active,
                    Address = user.Address,
                    Competences = user.Competences,
                    CVFileName = user.CVFileName,
                    DisplayName = user.DisplayName,
                    Email = user.Email,
                    ProfileImageSrc = _imageProvider.GetProfileImageSrc(),
                    Ideas = user.Ideas,
                    UserType = _sniService.GetTitle(user.Ideas.First().SniHeadId),
                    Name = user.Name,
                    LastLogin = user.LastLogin.ToFormattedString()
                };
 }
Esempio n. 4
0
 public User Present(Model.Users.AggregateRoots.IUser user)
 {
     _imageProvider = new ImageProvider(user);
     return new User
     {
         id = user.UserId,
         DisplayName = user.DisplayName,
         ProfileImageSrc = _imageProvider.GetProfileImageSrc(),
         Competences = user.Competences,
         City = user.Address.City,
         UserType = _userRepository.Query(m => m.UserTypes.First(ut => ut.UserTypeId == user.UserType)).Title,
         UserTypeId = user.UserType,
         // moved to idea?
         UserTypesNeeded = _userTypeService.GetUserTypesAsStrings(user.Ideas.First().SearchProfile.UserTypesNeeded),
         CompetencesNeeded = user.Ideas.First().SearchProfile.CompetencesNeeded,
         Ideas = user.Ideas.Select(_ideaPresenter.Convert),
         LookingFor = _lookingForPresenter.ToViewModel(user.LookingFor),
         DetailsHref = string.Format("/User/Details/{0}", user.UserId),
         Presentation = user.Presentation
     };
 }