Blog.Logic.Core.PostsLogic.GetPostsByUser C# (CSharp) Method

GetPostsByUser() public method

public GetPostsByUser ( int userId ) : List
userId int
return List
        public List<Post> GetPostsByUser(int userId)
        {
            var posts = new List<Post>();
            try
            {
                var db = _postRepository.GetByUser(userId).ToList();
                db.ForEach(a => posts.Add(PostMapper.ToDto(a)));
                posts.ForEach(a => GetPostProperties(a));
            }
            catch (Exception ex)
            {
                throw new BlogException(ex.Message, ex.InnerException);
            }
            return posts;
        }