Esempio n. 1
0
        public HashtagDTO ConvertModelToDTO(Hashtag tag)
        {
            var dto = new HashtagDTO();

            dto.HashtagID = tag.HashtagID;
            dto.Text      = tag.Text;
            return(dto);
        }
Esempio n. 2
0
        public List <HashtagDTO> ConvertModelListToDTO(ICollection <Hashtag> hashtags)
        {
            List <HashtagDTO> list = new List <HashtagDTO>();

            foreach (Hashtag tag in hashtags)
            {
                HashtagDTO dto = this.ConvertModelToDTO(tag);
                list.Add(dto);
            }
            return(list);
        }
Esempio n. 3
0
        public HashtagDTO GetPostsUsingHashtagDL(string name)
        {
            try
            {
                using (var context = new MiniBirdEntities())
                {
                    IQueryable <Post> posts      = context.Post.Where(p => p.Hashtag.Any(h => h.Name == name));
                    HashtagDTO        hashtagDTO = new HashtagDTO();
                    hashtagDTO.Name = name;

                    foreach (var post in posts)
                    {
                        var createdBy = context.Person.Find(post.ID_Person);

                        hashtagDTO.PostSection.Add(new PostSectionDTO()
                        {
                            PostID          = post.PostID,
                            Comment         = post.Comment,
                            GIFImage        = post.GIFImage,
                            VideoFile       = post.VideoFile,
                            Thumbnails      = new AccountDL().GetPostedThumbnails(post.PostID),
                            PublicationDate = post.PublicationDate,
                            CreatedBy       = createdBy.PersonID,
                            NickName        = createdBy.NickName,
                            UserName        = createdBy.UserName,
                            ProfileAvatar   = (createdBy.ProfileAvatar != null) ? ByteArrayToBase64(createdBy.ProfileAvatar, createdBy.ProfileAvatar_MimeType) : "/Content/images/defaultAvatar.png",
                            InteractButtons = new AccountDL().GetInteractsCountDL(post.PostID, ActiveSession.GetPersonID()),
                        });
                    }

                    return(hashtagDTO);
                }
            }
            catch
            {
                throw;
            }
        }
Esempio n. 4
0
 public Hashtag ConvertDTOToModel(HashtagDTO dto)
 {
     throw new NotImplementedException();
 }