private object GetCounter() { ApplicationCounterEntities context = new ApplicationCounterEntities(); var counter = context.Counters.FirstOrDefault(); var visitorsCount = counter.Count; return visitorsCount; }
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(); }