public IActionResult UpdateChart(int id,
                                         [FromBody] ChartForUpdateDto chart)
        {
            if (chart == null)
            {
                return(BadRequest());
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (!_chartRepository.ChartExists(id))
            {
                return(NotFound());
            }

            var chartEntity = _chartRepository.GetChart(id);

            if (chartEntity == null)
            {
                return(NotFound());
            }

            Mapper.Map(chart, chartEntity);

            if (!_chartRepository.Save())
            {
                return(StatusCode(500, "A problem happened while handling your request."));
            }

            return(NoContent());
        }
        public IActionResult GetValuePairs(int chartId)
        {
            try
            {
                if (!_chartRepository.ChartExists(chartId))
                {
                    return(NotFound());
                }

                var valuePairsForChart        = _chartRepository.GetValuePairsForChart(chartId);
                var valuePairsForChartResults =
                    Mapper.Map <IEnumerable <ValuePairDto> >(valuePairsForChart);

                return(Ok(valuePairsForChartResults));
            }
            catch
            {
                return(StatusCode(500, "A problem happened while handling your request."));
            }
        }