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;
}