public async Task <IActionResult> AddOrUpdateMetricBarHeightsAsync( [FromBody] BarHeightsForm <MetricBarHeight> barHeightsForm, CancellationToken ct) { if (!ModelState.IsValid) { return(BadRequest(new ApiError(ModelState))); } var evt = await _eventService.GetEventByIdAsync(barHeightsForm.eventId, ct); if (evt.Params.EventType[0] != 'V') { return(BadRequest("Event type not vertical")); } if (evt.Params.MeasurementType[0] != 'M') { return(BadRequest("Measurement type not metric")); } await _eventService.AddOrUpdateMetricBarHeightsAsync( barHeightsForm, ct); return(Created(Url.Link(nameof(EventsController.GetEventByIdAsync), new { barHeightsForm.eventId }), null)); }