Blog.Logic.Core.MediaLogic.GetByUser C# (CSharp) Method

GetByUser() public method

public GetByUser ( int userId ) : List
userId int
return List
        public List<Media> GetByUser(int userId)
        {
            var media = new List<Media>();
            try
            {
                var album = _albumRepository.Find(a => a.UserId == userId, null, "User,Media").ToList();
                album.ForEach(a => media.AddRange(a.Media.Select(MediaMapper.ToDto)));
            }
            catch (Exception ex)
            {
                throw new BlogException(ex.Message, ex.InnerException);
            }
            return media;
        }