public void Calculate() { Pprodvarme _pprodvarme = _context.Pprodvarme.OrderByDescending(p => p.Datetime).FirstOrDefault(); Pprodvv _pprodvv = _context.Pprodvv.OrderByDescending(p => p.Datetime).FirstOrDefault(); Ptotude _ptotude = _context.Ptotude.OrderByDescending(p => p.Datetime).FirstOrDefault(); Value = (_pprodvarme.Value + _pprodvv.Value - 15897) / (_ptotude.Value - 2002); /* Value = (_pprodvarme.Value + _pprodvv.Value - 8385) / (_ptotude.Value - 5); */ }
public JsonResult GetAll() { using (_context) { // Create a List List <Measurement> Mlist = new List <Measurement>(); Tinde _tinde = _context.Tinde.OrderByDescending(p => p.Datetime).FirstOrDefault(); Mlist.Add(_tinde); Tude _tude = _context.Tude.OrderByDescending(p => p.Datetime).FirstOrDefault(); Mlist.Add(_tude); Treturr _treturr = _context.Treturr.OrderByDescending(p => p.Datetime).FirstOrDefault(); Mlist.Add(_treturr); Tvv _tvv = _context.Tvv.OrderByDescending(p => p.Datetime).FirstOrDefault(); Mlist.Add(_tvv); Tzinde _tzinde = _context.Tzinde.OrderByDescending(p => p.Datetime).FirstOrDefault(); Mlist.Add(_tzinde); Tfremr _tfremr = _context.Tfremr.OrderByDescending(p => p.Datetime).FirstOrDefault(); Mlist.Add(_tfremr); Tfremberr _tfremberr = _context.Tfremberr.OrderByDescending(p => p.Datetime).FirstOrDefault(); Mlist.Add(_tfremberr); Tfrainde _tfrainde = _context.Tfrainde.OrderByDescending(p => p.Datetime).FirstOrDefault(); Mlist.Add(_tfrainde); Vkurve _vkurve = _context.Vkurve.OrderByDescending(p => p.Datetime).FirstOrDefault(); Mlist.Add(_vkurve); Qcirc _qcirc = _context.Qcirc.OrderByDescending(p => p.Datetime).FirstOrDefault(); Mlist.Add(_qcirc); Ptotude _ptotude = _context.Ptotude.OrderByDescending(p => p.Datetime).FirstOrDefault(); Mlist.Add(_ptotude); Pude _pude = _context.Pude.OrderByDescending(p => p.Datetime).FirstOrDefault(); Mlist.Add(_pude); Pprodvv _pprodvv = _context.Pprodvv.OrderByDescending(p => p.Datetime).FirstOrDefault(); Mlist.Add(_pprodvv); Pprodvarme _pprodvarme = _context.Pprodvarme.OrderByDescending(p => p.Datetime).FirstOrDefault(); Mlist.Add(_pprodvarme); Grmin _grmin = _context.Grmin.OrderByDescending(p => p.Datetime).FirstOrDefault(); Mlist.Add(_grmin); Componoff _componoff = _context.Componoff.OrderByDescending(p => p.Datetime).FirstOrDefault(); Mlist.Add(_componoff); Alarmer _alarmer = _context.Alarmer.OrderByDescending(p => p.Datetime).FirstOrDefault(); Mlist.Add(_alarmer); Ttilinde _ttilinde = _context.Ttilinde.OrderByDescending(p => p.Datetime).FirstOrDefault(); Mlist.Add(_ttilinde); Tstopude _tstopude = _context.Tstopude.OrderByDescending(p => p.Datetime).FirstOrDefault(); Mlist.Add(_tstopude); JsonResult Measurementsresult = new JsonResult(Mlist); return(Measurementsresult); } }