Beispiel #1
0
        private object GetCounter()
        {
            ApplicationCounterEntities context = new ApplicationCounterEntities();
            var counter = context.Counters.FirstOrDefault();

            var visitorsCount = counter.Count;
            return visitorsCount;
        }
Beispiel #2
0
        private void EnrollUser()
        {
            ApplicationCounterEntities context = new ApplicationCounterEntities();
            var counter = context.Counters.FirstOrDefault();

            if (counter == null)
            {
                context.Counters.Add(new Counter { Id = 1 });
            }
            else
            {
                counter.Count++;
            }

            context.SaveChanges();
        }