Beispiel #1
0
        public ResultHeat Post([FromBody] DPInputData dt)
        {
            var result = new ResultHeat();

            result = Calculate.Calculator(dt);

            return(result);
        }
Beispiel #2
0
        public bool Post(DeleteData dd)
        {
            string token = Request.Headers["Authorization"];

            int userid = new SecurityMethods().ParseToken(token);

            DPInputData a = DpDataBase.Inputs.First(p => p.NAME == dd.ParamsName && p.UserId == userid);

            DpDataBase.Inputs.Remove(a);
            DpDataBase.SaveChanges();

            return(true);
        }
Beispiel #3
0
        public bool Patch(SaveParams sp)
        {
            string token  = Request.Headers["Authorization"];
            int    userid = new SecurityMethods().ParseToken(token);

            DPInputData a = DpDataBase.Inputs.First(p => p.NAME == sp.name && p.UserId == userid);

            a.NAME            = sp.name;
            a.InputIndicators = sp.dpi.InputIndicators;
            a.InputData2      = sp.dpi.InputData2;
            DpDataBase.Inputs.Attach(a);
            DpDataBase.SaveChanges();
            return(true);
        }
Beispiel #4
0
        [HttpPost] // Контроллер для принятия и сейва входных параметров :)
        public bool Post([FromBody] SaveParams sp)
        {
            string token  = Request.Headers["Authorization"];
            int    userid = new SecurityMethods().ParseToken(token);

            if (DpDataBase.Inputs.Where(p => p.UserId == userid).Select(x => x.NAME).ToList().Contains(sp.name))
            {
                return(false);
            }

            var dataInput = new DPInputData()
            {
                UserId          = userid,
                NAME            = sp.name,
                InputIndicators = sp.dpi.InputIndicators,
                InputData2      = sp.dpi.InputData2
            };

            DpDataBase.Inputs.Add(dataInput);
            DpDataBase.SaveChanges();
            return(true);
        }