public async Task <IActionResult> Edit(int id, [Bind("Id,Name,GroupId,Type,ModelId,IsMonitoring")] Device device, List <string> InterfacesNames,
                                               List <string> InterfacesAddresses)
        {
            if (id != device.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    List <Interface> interfaces = _helper.GetInterfacesFromNameAddress(InterfacesNames, InterfacesAddresses);
                    await _devicesRepository.UpdateAsync(device, interfaces);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DeviceExists(device.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            DeviceVM.Groups = await _groupsRepository.GetAll().ToListAsync();

            return(View(DeviceVM.Groups));
        }
        public async Task <IActionResult> DeviceVersion([FromBody] Device device)
        {
            var deviceFromDb = await _devicesRepository.GetAsync(device.Id);

            if (deviceFromDb == null)
            {
                return(NotFound());
            }

            (bool, string)result = _serviceAccessor("M").ExecuteSSHCommand(deviceFromDb,
                                                                           _commandsRepository.GetDeviceVersion(), "admin", "");

            if (result.Item1 == true)
            {
                deviceFromDb.Version = result.Item2;
            }

            await _devicesRepository.UpdateAsync(deviceFromDb);

            return(RedirectToAction("Index", "Devices", new { message = result }));
        }