コード例 #1
0
        public IActionResult SubmitEntry([FromRoute] int id, CreateMetricEntryRequest requestBody)
        {
            var metric = _metricsManager.GetMetric(id);
            if (metric == null)
            {
                return NotFound(new
                {
                    message = "A metric with this ID does not exist."
                });
            }

            var entry = requestBody.ToEntry();
            entry.MetricId = metric.Id;
            entry = _metricsManager.CreateEntry(entry);

            return Ok(entry);
        }