示例#1
0
        public ActionResult PicturesSave(string discriptin, HttpPostedFileBase image)
        {
            var name = User.Identity.Name;

            var user = _userService.GetUserByUserName(name);

            var userDetail = _detailService.GetDetailByUserId(user.Id);

            var picture = new byte[image.ContentLength];

            image.InputStream.Read(picture, 0, image.ContentLength);

            _postService.AddPostToUser(user, discriptin, picture, false);

            return(RedirectToAction("Pictures/" + User.Identity.Name, "DetaialUser"));
        }
        public ActionResult CreatePost(string discriptin, HttpPostedFileBase image)
        {
            var userLogged = _userService.GetUserByUserName(this.User.Identity.Name);

            var pitureBytes = new byte[0];

            if (image != null)
            {
                pitureBytes = new byte[image.ContentLength];
                image.InputStream.Read(pitureBytes, 0, image.ContentLength);
            }

            _postService.AddPostToUser(userLogged, discriptin, pitureBytes, false);

            return(RedirectToAction("Index", "DetaialUser"));
        }