コード例 #1
0
        public IActionResult GetPoints([FromQuery(Name = "measurementid")] int measurementId, [FromQuery(Name = "deviceid")] int deviceId, [FromQuery(Name = "graphicid")] int graphicId, [FromQuery(Name = "port")] int port)
        {
            var pointsDictionary = new Dictionary <string, List <object> >();
            var pointsList       = new List <object>(measurementProvider.GetPoints(measurementId, deviceId, graphicId, port)
                                                     .Select(x => new
            {
                Value      = x.Value, Time = x.Time.Trim(TimeSpan.TicksPerMinute), DeviceId = x.DeviceId,
                PortNumber = x.PortNumber
            }));

            pointsDictionary.Add($"M{measurementId}D{deviceId}PN{port}", pointsList);
            if (pointsList.Count == 0)
            {
                return(NoContent());
            }
            return(Ok(pointsDictionary));
        }