Ejemplo n.º 1
0
 public void EvaluatePost(CompletePostDTO post)
 {
     if (!CreatePost(post))
     {
         postHandler?.EvaluatePost(post);
     }
 }
Ejemplo n.º 2
0
        protected override bool CreatePost(CompletePostDTO post)
        {
            if (post.FileInPost == null || post.FileInPost.Length == 0)
            {
                postRepository.Add(post.Post);
                unitOfWork.Commit();

                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
        protected override bool CreatePost(CompletePostDTO post)
        {
            if (post.FileInPost.ContentType.Equals("video/mp4", StringComparison.OrdinalIgnoreCase) ||
                post.FileInPost.ContentType.Equals("video/avi", StringComparison.OrdinalIgnoreCase))
            {
                string multimedia = cloudinary.VideoUpload(post.FileInPost);

                post.Post.Multimedia = multimedia;
                postRepository.Add(post.Post);
                unitOfWork.Commit();

                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        public PostDTO AddPost(IFormFile file, Post post)
        {
            CompletePostDTO completePost = new CompletePostDTO()
            {
                FileInPost = file,
                Post       = post
            };

            IPostHandler textPost  = new PostText(postRepository, unitOfWork);
            IPostHandler imagePost = new PostImage(postRepository, unitOfWork, cloudinary);
            IPostHandler videoPost = new PostVideo(postRepository, unitOfWork, cloudinary);

            textPost.SetNextPostType(imagePost);
            imagePost.SetNextPostType(videoPost);

            textPost.EvaluatePost(completePost);

            return(mapper.Map <PostDTO>(post));
        }
Ejemplo n.º 5
0
 protected abstract bool CreatePost(CompletePostDTO post);