Ejemplo n.º 1
0
        public async Task <IActionResult> CreateCPUDatapoint([FromBody] CPU_Usage c)
        {
            CPU_Usage point = new CPU_Usage
            {
                usage     = c.usage,
                timestamp = c.timestamp.ToUniversalTime(),
            };

            _MetricContext.CPU_Usage.Add(point);
            await _MetricContext.SaveChangesAsync();

            return(CreatedAtAction("CPU Data Created", new { date = point.timestamp }, null));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> GetCPUDataByTime(DateTime d, Session sess)
        {
            CPU_Usage point = await _MetricContext.CPU_Usage.SingleOrDefaultAsync(cpu => (cpu.timestamp.ToUniversalTime() == d.ToUniversalTime() && sess.Id == cpu.AppId));

            return(Ok(point));
        }