Ejemplo n.º 1
0
        public ActionResult <List <CommentViewModel> > GetBlogComments(long id)
        {
            _logger.LogInfo("Blog yorumlarý alýnyor " + id + ". ");

            List <Model.Comment> blogComments;

            if (!_cache.TryGetValue <List <Model.Comment> >(CacheKeys.BlogCommentsKey(id), out blogComments))
            {
                blogComments = _commentRepository.FindBy(s => s.BlogId == id).ToList();
                if (blogComments != null)
                {
                    _cache.Set <List <Model.Comment> >(CacheKeys.BlogCommentsKey(id), blogComments);
                }
            }
            var userId = HttpContext.User.Identity.Name;

            return(_mapper.Map <List <Model.Comment>, List <CommentViewModel> >(blogComments));
        }