public IActionResult Wall(UserWallRequest request) { var userwall = _userservice.FindByName(request.UserName); var guest = _userservice.FindByName(request.GuestName); var wall = new WallResponse(); if (userwall.BlockedUserId.Contains(guest.UserId)) { return(BadRequest(new { Message = "This User has you blocked: " + userwall.Name })); } foreach (var circleIds in userwall.CircleId) { var circle = _circleService.Get(circleIds); if (circle.UserId.Contains(guest.UserId)) { foreach (var postId in circle.PostId) { var post = _postService.Get(postId); if (post.UserId == userwall.UserId) { wall.Responses.Add(_mapper.Map <PostResponse>(post)); } } } } foreach (var postId in userwall.PostId) { var post = _postService.Get(postId); if (post.Public) { wall.Responses.Add(_mapper.Map <PostResponse>(post)); } } return(Ok(wall.Responses)); }
public ActionResult <CircleResponse> Get(string id) { var circle = _CircleService.Get(id); if (circle == null) { return(NotFound()); } return(Ok(_mapper.Map <CircleResponse>(circle))); }