public HashtagDTO ConvertModelToDTO(Hashtag tag) { var dto = new HashtagDTO(); dto.HashtagID = tag.HashtagID; dto.Text = tag.Text; return(dto); }
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); }
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; } }
public Hashtag ConvertDTOToModel(HashtagDTO dto) { throw new NotImplementedException(); }