Пример #1
0
        public ActionResult Create([FromForm] Post post, string id)
        {
            try
            {
                post.CreationTime = DateTime.Now;
                _postRepository.CreatePost(post);

                Wall wall;
                if (post.CircleId == null)
                {
                    wall = _wallRepository.GetWallByUserId(post.OwnerId);
                }

                else
                {
                    wall = _wallRepository.GetWallByCircleId(post.CircleId);
                }

                wall.Posts.Add(post.PostId);

                _wallRepository.Update(wall);

                return(RedirectToAction("Details", "Post", new { @id = post.PostId }));
            }
            catch
            {
                return(RedirectToAction("Details", "Post", new { @id = post.PostId }));
            }
        }
Пример #2
0
        public ActionResult DetailsFromCircle(string circleId, string userId)
        {
            var user = _userRepository.GetUser(userId);

            var wall = _wallRepository.GetWallByCircleId(circleId);

            ViewData["visitor"] = userId;
            return(View(wall));
        }