Exemplo n.º 1
0
        public void GetReplies(IGetDetails getDetails)
        {
            var replies = _Schemas.Replies;

            replies.Entity.request_id = getDetails.RequestId;
            getDetails.Replies        = replies.Select.Result;
            getDetails.ReplyCount     = getDetails.Replies.Count;
        }
Exemplo n.º 2
0
        private bool IsAdmin(IGetDetails getDetails)
        {
            if (!getDetails.SessionActive)
            {
                return(false);
            }
            var member = _Schemas.Members;

            member.Entity.username = getDetails.SessionIdValue;
            member.Entity.admin    = EnumAdmin.Admin;
            return(member.Count == 1);
        }
Exemplo n.º 3
0
        public LinkDetailsDto GetDetails(string url)
        {
            IGetDetails hosting = RepositoryFactory.GetHosting(url);

            var toReturn = new LinkDetailsDto();

            toReturn.Title        = hosting.GetTitle();
            toReturn.Provider     = hosting.GetProvider();
            toReturn.ThumbnailUrl = hosting.GetThumbnailUrl();
            toReturn.AuthorName   = hosting.GetUserName();
            toReturn.Duration     = hosting.GetDuration();
            toReturn.Likes        = hosting.GetLikes();

            return(toReturn);
        }
Exemplo n.º 4
0
        public static IGetDetails GetHosting(string url)
        {
            IGetDetails details = null;

            if (url.Contains("youtube") || url.Contains("youtu"))
            {
                return(details = new GetDetailYT(url));
            }

            if (url.Contains("vimeo"))
            {
                return(details = new GetDetailVimeo(url));
            }

            return(details);
        }
Exemplo n.º 5
0
        public ValidationResult ValidateRequestId(IGetDetails getDetails)
        {
            var requests = _Schemas.Requests;

            requests.Entity.id = getDetails.RequestId;
            if (!this.IsAdmin(getDetails))
            {
                requests.Entity.publicity = EnumPublic.Public;
            }
            if (requests.Count == 0)
            {
                return(TfValidationResult.Compose(
                           "DataNotFound",
                           nameof(getDetails.RequestId)));
            }
            return(null);
        }