Exemplo n.º 1
0
        public void Crunch(ptOSContainer context, object obj)
        {
            var now = DateTime.UtcNow;
            var stat = context.Statistics.FirstOrDefault(x => x.Type == Name);
            if (stat == null)
            {
                stat = context.Statistics.Add(new Statistic
                {
                    Type = Name,
                    At = now,
                });
            }
            var hourAgo = now.AddHours(-1);
            stat.Value = context.Events.Count(x => x.Submitted > hourAgo);

            context.SaveChanges();
        }
Exemplo n.º 2
0
        public void Crunch(ptOSContainer context, object obj)
        {
            var now  = DateTime.UtcNow;
            var stat = context.Statistics.FirstOrDefault(x => x.Type == Name);

            if (stat == null)
            {
                stat = context.Statistics.Add(new Statistic
                {
                    Type = Name,
                    At   = now,
                });
            }
            var hourAgo = now.AddHours(-1);

            stat.Value = context.Events.Count(x => x.Submitted > hourAgo);

            context.SaveChanges();
        }
Exemplo n.º 3
0
 public BaseApiController()
 {
     Context = new ptOSContainer();
 }