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)); }
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)); }