public async Task <bool> DeviceStatus(int?id)
        {
            var device = await _devicesRepository.GetAsync(id);

            if (device == null)
            {
                return(false);
            }

            foreach (var ethernet in device.Interfaces)
            {
                using (var ping = new Ping())
                {
                    string    ip        = (ethernet.Address.Contains("/")) ? ethernet.Address.Split('/')[0] : ethernet.Address;
                    PingReply pingReply = await ping.SendPingAsync(ip, 1000);

                    if (pingReply.Status == IPStatus.Success)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
        public async Task <IActionResult> Details(int?id, string message)
        {
            if (id == null)
            {
                return(NotFound());
            }

            DeviceVM.Device = await _devicesRepository.GetAsync(id);

            if (DeviceVM.Device == null)
            {
                return(NotFound());
            }

            DeviceVM.Accounts = _accountsRepository.GetDeviceAccounts(id.GetValueOrDefault()).ToList();

            ViewBag.Message = message;
            return(View(DeviceVM));
        }