예제 #1
0
        public object ProductViewFrequency()
        {
            List <ProductViewingInfo> productViewFrequency = _productsBL.GetProductViewingInfos();

            return(new
            {
                data = productViewFrequency.Select(x => new ProductViewFreqencyViewModel
                {
                    IpAddress = x.UserHostAddress.IpAddress,
                    LastViewDate = x.Count == 1 ? x.Created.Value : x.Updated.Value,
                    ProductId = x.ProductId,
                    ProductName = x.Product.Name,
                    ViewCount = x.Count,
                    UserId = x.UserId
                }).ToList()
            });
        }