Ejemplo n.º 1
0
        public IActionResult ProcessKeyLog([FromBody] List <amModel> itemList)
        {
            if (itemList == null)
            {
                return(BadRequest());
            }

            using (var db = new amContext())
            {
                db.DeleteDataSuccessSendToServer();

                itemList.ForEach(item => db.CreateData(item));
            }

            return(CreatedAtRoute("api/amController/ProcessKeyLog", new { id = itemList[0].amModelId }, itemList));
        }
Ejemplo n.º 2
0
        public Startup(IHostingEnvironment env)
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(env.ContentRootPath)
                          .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
                          .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
                          .AddEnvironmentVariables()
            ;

            Configuration = builder.Build();

            using (var db = new amContext())
            {
                db.Database.EnsureCreated();
                db.Database.Migrate();
            }
        }
Ejemplo n.º 3
0
        public IActionResult ProcessCaptureImage([FromBody] List <amCapture> itemList)
        {
            if (itemList == null)
            {
                return(BadRequest());
            }
            ;

            using (var db = new amContext())
            {
                db.DeleteImageSuccessSendToServer();

                itemList.ForEach(item => db.SaveImageData(item));
            }

            return(Ok());
            //return Ok(itemList);
            //return CreatedAtRoute("api/amController/ProcessCaptureImage", new { id = itemList[0].amCaptureId }, itemList);
        }
Ejemplo n.º 4
0
        public amController(amContext context)
        {
            _context = context;

            if (_context.amModel.Count() == 0 && _context.amCapture.Count() == 0)
            {
                _context.amModel.Add(new amModel());
                _context.amCapture.Add(new amCapture());
                _context.SaveChanges();
            }
            else if (_context.amModel.Count() == 0 && _context.amCapture.Count() != 0)
            {
                _context.amModel.Add(new amModel());
                _context.SaveChanges();
            }
            else if (_context.amModel.Count() != 0 && _context.amCapture.Count() == 0)
            {
                _context.amCapture.Add(new amCapture());
                _context.SaveChanges();
            }
        }