예제 #1
0
        public void View(string datasetId)
        {
            ViewEntry item = this.context.ViewEntry.Where(t => t.DatasetId == datasetId).FirstOrDefault();
            //if (this.context.ViewEntry.Where(t => t.DatasetId == datasetId).ToList().Count > 0)
            if(item != null)
            {
                item.Views++;
                this.context.UpdateObject(item);
            }
            else
            {
                item = new ViewEntry() {DatasetId = datasetId, Views=1 };
                this.context.AddObject("ViewEntry", item);
            }

            this.context.SaveChanges();
        }
예제 #2
0
        public void View(string datasetId)
        {
            ViewEntry item = this.context.ViewEntry.Where(t => t.DatasetId == datasetId).FirstOrDefault();

            //if (this.context.ViewEntry.Where(t => t.DatasetId == datasetId).ToList().Count > 0)
            if (item != null)
            {
                item.Views++;
                this.context.UpdateObject(item);
            }
            else
            {
                item = new ViewEntry()
                {
                    DatasetId = datasetId, Views = 1
                };
                this.context.AddObject("ViewEntry", item);
            }

            this.context.SaveChanges();
        }