Blog.Logic.Core.ViewCountLogic.Get C# (CSharp) Method

Get() public method

public Get ( int postId ) : List
postId int
return List
        public List<ViewCount> Get(int postId)
        {
            var viewCounts = new List<ViewCount>();
            try
            {
                var db = _viewCountRepository.Find(a => a.PostId == postId, true).ToList();
                db.ForEach(a => viewCounts.Add(ViewCountMapper.ToDto(a)));
            }
            catch (Exception ex)
            {
                throw new BlogException(ex.Message, ex.InnerException);
            }
            return viewCounts;
        }