public async Task <IActionResult> Edit(int id, [Bind("CameraCode,CameraUrl,Port,Username,Password,Id")] CameraSettingModel cameraSettingModel)
        {
            if (id != cameraSettingModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cameraSettingModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CameraSettingModelExists(cameraSettingModel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(cameraSettingModel));
        }
        public async Task <IActionResult> Create([Bind("CameraCode,CameraUrl,Port,Username,Password,Id")] CameraSettingModel cameraSettingModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cameraSettingModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(cameraSettingModel));
        }
        public async Task <IActionResult> Monitor()
        {
            CameraSettingModel camera = new CameraSettingModel();

            camera = await(from macs in _context.CameraSetting
                           select macs).FirstOrDefaultAsync();

            ViewBag.CameraCode = camera.CameraCode;
            ViewBag.CameraUrl  = camera.CameraUrl;
            ViewBag.CameraPort = camera.Port;

            return(View());
        }