Blog.Logic.Core.CommunityLogic.GetCreatedByUser C# (CSharp) Method

GetCreatedByUser() public method

public GetCreatedByUser ( int userId ) : List
userId int
return List
        public List<Community> GetCreatedByUser(int userId)
        {
            var communities = new List<Community>();
            try
            {
                var db = _communityRepository.GetCreatedCommunitiesByUser(userId).ToList();
                db.ForEach(a =>
                {
                    var result = CommunityMapper.ToDto(a);
                    result.MemberCount = GetCommunityMemberCount(result.Id);
                    communities.Add(result);
                });
            }
            catch (Exception ex)
            {
                throw new BlogException(ex.Message, ex.InnerException);
            }
            return communities;
        }