public IActionResult DeleteValuePair(int chartId, int id) { if (!_chartRepository.ChartExists(chartId)) { return(NotFound()); } var valuePairEntity = _chartRepository.GetValuePairForChart(chartId, id); if (valuePairEntity == null) { return(NotFound()); } _chartRepository.DeleteValuePair(valuePairEntity); if (!_chartRepository.Save()) { return(StatusCode(500, "A problem happened while handling your request.")); } return(NoContent()); }