Exemple #1
0
        public static void IncPageView(this MKContext db, Item item)
        {
            var pv = item.PageView;

            if (pv == null)
            {
                pv = new PageView {
                    Item = item
                };
                db.PageViews.Add(pv);
            }
            pv.VisitCount++;
            db.SaveChanges();
        }
Exemple #2
0
        public static int GetPageViewCount(this MKContext db, Item item)
        {
            var pv = item.PageView;

            if (pv == null)
            {
                pv = new PageView {
                    Item = item
                };
                db.PageViews.Add(pv);
                db.SaveChanges();
            }
            return(pv.VisitCount);
        }