Esempio n. 1
0
        // GET: User/Details/5
        public ActionResult Details(string id)
        {
            ViewData["userlist"] = _userRepository.GetUsers();

            var wall = _wallRepository.GetWallByUserId(id);

            if (wall == null)
            {
                wall = new Wall {
                    User = id
                };
                _wallRepository.AddWall(wall);
            }


            ViewData["wall"] = wall;
            var posts = new List <Post>();

            if (wall != null)
            {
                foreach (var post in wall.Posts)
                {
                    posts.Add(_postRepository.GetPost(post));
                }
            }

            ViewData["posts"] = posts;

            return(View(_userRepository.GetUser(id)));
        }
Esempio n. 2
0
        // GET: Wall/Details/5
        public ActionResult Details(string id)
        {
            var wall = _wallRepository.GetWallById(id);

            if (wall != null)
            {
                return(View(wall));
            }

            wall = _wallRepository.GetWallByUserId(id);
            if (wall != null)
            {
                return(View(wall));
            }

            wall = new Wall {
                User = id
            };
            _wallRepository.AddWall(wall);
            return(View(wall));
        }
Esempio n. 3
0
        public ActionResult Create(Circle circle)
        {
            try
            {
                _circleRepository.InsertCircle(circle);


                var wall = _wallRepository.AddWall(new Wall
                {
                    Circle = circle.CircleId
                });

                circle.WallId = wall.WallId;
                _circleRepository.UpdateCircle(circle);
                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }