示例#1
0
        public async Task <ActionResult <Chart> > PostChart(Chart chart)
        {
            // _context.Charts.Add(chart);
            // await _context.SaveChangesAsync();

            try
            {
                _repository.AddChartItem(chart);
                _repository.SaveChartItem();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }

            return(CreatedAtAction("GetChart", new { id = chart.Id }, chart));
        }