Пример #1
0
        public void Post([FromBody] Chart chart)
        {
            Chart c = new Chart();

            //var chartCount = (from a in db.Chart
            //                 select a).Count();

            //c.ChartId = chartCount + 1;
            c.Headline    = chart.Headline;
            c.Description = chart.Description;

            db.Chart.Add(c);
            db.SaveChanges();
        }
Пример #2
0
        public void Post([FromBody] Content content)
        {
            Content c = new Content();


            c.ValueX = content.ValueX;
            c.ValueY = content.ValueY;

            db.Content.Add(c);
            db.SaveChanges();
        }
        private void AddDataToDB(FunctionViewModel functionView, IEnumerable <Point> points)
        {
            UserData userData = new UserData
            {
                a         = functionView.a,
                b         = functionView.b,
                c         = functionView.c,
                Step      = functionView.step,
                RangeFrom = functionView.from,
                RangeTo   = functionView.to
            };

            chartDB.UserDatas.Add(userData);
            chartDB.SaveChanges();

            foreach (var point in points)
            {
                chartDB.Add(point.GetDBModel(userData));
            }
            chartDB.SaveChanges();
        }