Esempio n. 1
0
        public IViewComponentResult Invoke(BookViewModel model)
        {
            var dto   = _mapper.Map <BookViewModel, BookDto>(model);
            var count = _wishListService.GetLikesCount(dto);
            var liked = _wishListService.IsInWishList(UserClaimsPrincipal, dto);

            if (liked)
            {
                return(new HtmlContentViewComponentResult(
                           new HtmlString($"<a href=\"/WishList/RemoveFromWishList/{model.Id}\" class=\"btn btn-danger fa fa-heart\">\t{count}</a>")));
            }

            return(new HtmlContentViewComponentResult(
                       new HtmlString($"<a href=\"/WishList/AddToWishList/{model.Id}\" class=\"btn btn-danger fa fa-heart-o\">\t{count}</a>")));
        }