Ejemplo n.º 1
0
        public ActionResult Update(PostDTO data, HttpPostedFileBase Image)
        {
            List <string> UploadImagePaths = new List <string>();

            UploadImagePaths = ImageUploader.UploadSingleImage(ImageUploader.OriginalProfileImagePath, Image, 1);

            data.ImagePath = UploadImagePaths[0];

            Post post = _postRepo.GetById(data.Id);

            if (data.ImagePath == "1" || data.ImagePath == "2" || data.ImagePath == "3")
            {
                if (post.ImagePath == null || post.ImagePath == ImageUploader.DefaultProfileImagePath)
                {
                    post.ImagePath = ImageUploader.DefaultProfileImagePath;
                    post.ImagePath = ImageUploader.DefaultXSmallProfileImagePath;
                    post.ImagePath = ImageUploader.DefaultCruptedProfileImagePath;
                }
            }
            else
            {
                post.ImagePath = UploadImagePaths[0];
                post.ImagePath = UploadImagePaths[1];
                post.ImagePath = UploadImagePaths[2];
            }

            post.Header       = data.Header;
            post.Content      = data.Content;
            post.CategoryId   = data.CategoryId;
            post.AppUserId    = data.AppUserId;
            post.status       = Status.Active;
            post.ModifiedDate = DateTime.Now;
            _postRepo.Update(post);
            return(Redirect("/Admin/Post/List"));
        }
        public ActionResult Update(PostDTO data)
        {
            Post post = _postRepo.GetById(data.Id);

            post.Header     = data.Header;
            post.Content    = data.Content;
            post.CategoryId = data.CategoryId;
            post.AppUserId  = data.AppUserId;
            post.Status     = Status.Active;
            post.UpdateDate = DateTime.Now;
            _postRepo.Update(post);
            return(Redirect("/Admin/Post/List"));
        }