Beispiel #1
0
        public SportEventDetailDTO MapToDTO(SportEvent source)
        {
            SportEventDetailDTO target = new SportEventDetailDTO();

            target.Id          = source.Id;
            target.Date        = source.Date;
            target.Description = source.Description;
            target.Title       = source.Title;
            target.ImagePath   = source.ImagePath;

            AccountMapper accountMapper = new AccountMapper();

            target.Owner = accountMapper.MapToDTO(source.Owner);

            AdressMapper adressMapper = new AdressMapper();

            target.Adress = adressMapper.MapToDTO(source.Adress);

            SportMapper sportMapper = new SportMapper();

            target.Category = sportMapper.MapToDTO(source.Category);

            AccountSimpleMapper accountSimpleMapper = new AccountSimpleMapper();

            target.Attendees = new HashSet <AccountSimpleDTO>();

            foreach (var ac in source.Attendees)
            {
                target.Attendees.Add(accountSimpleMapper.MapToDTO(ac));
            }

            return(target);
        }
Beispiel #2
0
        public FriendshipDTO MapToDTO(Friendship source)
        {
            FriendshipDTO target = new FriendshipDTO();

            target.Id    = source.Id;
            target.Since = source.Since;

            AccountSimpleMapper accountMapper = new AccountSimpleMapper();

            target.UserOne = accountMapper.MapToDTO(source.UserOne);
            target.UserTwo = accountMapper.MapToDTO(source.UserTwo);

            return(target);
        }
        public MessageDTO MapToDTO(Message source)
        {
            MessageDTO target = new MessageDTO();

            target.Id   = source.Id;
            target.Text = source.Text;
            target.Date = source.Date;

            AccountSimpleMapper accountMapper = new AccountSimpleMapper();

            target.User = accountMapper.MapToDTO(source.User);

            target.ConversationId = source.Conversation.Id;

            return(target);
        }
        public ConversationDTO MapToDTO(Conversation source)
        {
            ConversationDTO target = new ConversationDTO();

            target.Id = source.Id;

            AccountSimpleMapper accountMapper = new AccountSimpleMapper();

            target.UserOne = accountMapper.MapToDTO(source.UserOne);
            target.UserTwo = accountMapper.MapToDTO(source.UserTwo);

            MessageMapper messageMapper = new MessageMapper();

            target.Messages = new HashSet <MessageDTO>();

            return(target);
        }