public IActionResult Code(string code)
        {
            if (code == "999")
            {
                return(View(new CodeViewModel()
                {
                    Device = new Device(),
                    Code = new Code()
                }));
            }

            var c = _codeService.ByCode(code);

            if (c == null)
            {
                return(Redirect("/"));
            }

            var timespan = DateTime.Now - c.CreatedDate;

            if (timespan.Minutes > 5)
            {
                Console.Write("Code expired, diff: " + timespan.Minutes);
                return(Redirect("/"));
            }

            var device = _deviceService.Get(c.DeviceId);

            return(View(new CodeViewModel()
            {
                Device = device,
                Code = c
            }));
        }
        public IActionResult Get(string id)
        {
            var code = _codeService.ByCode(id);

            if (code == null)
            {
                Console.Write("Code not found");
                return(new NotFoundObjectResult(false));
            }

            var timespan = DateTime.Now - code.CreatedDate;

            if (timespan.Minutes > 5)
            {
                Console.Write("Code expired, diff: " + timespan.Minutes);
                return(new NotFoundObjectResult(false));
            }

            var device = _deviceService.Get(code.DeviceId);

            return(new OkObjectResult(new {
                id = device.UniqueIdentifier,
                player = code.Player
            }));
        }