// 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))); }
// 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)); }
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()); } }