예제 #1
0
        public async Task<ActionResult> Index()
        {
            var ipAddress = Request.UserHostAddress;
            var macAddress = NativeMethods.GetMacAddress(ipAddress);
            var deviceService = new DeviceService();
            var device = await deviceService.Get(ipAddress, macAddress);

            if (device != null && device.IsLocalized)
            {
                return RedirectToAction("Index", "Dashboard");
            }

            var roomService = new RoomService();
            var rooms = await roomService.Get();

            Session["Rooms"] = rooms;

            var model = new LocalizationViewModel
            {
                IpAddress = ipAddress,
                MacAddress = macAddress,
                Departments = rooms.Select(x => x.Department).DistinctBy(x => x.Name)
            };

            return View(model);
        }
예제 #2
0
        public void GetLocations(string room, string department)
        {
            var roomService = new RoomService();
            var existingRoom = Task.Run(async () => await roomService.Get(department, room)).Result;

            Clients.Caller.locationsRecieved(existingRoom.Locations);
        }
예제 #3
0
        public void GetRooms(string department)
        {
            if (string.IsNullOrEmpty(department))
            {
                Clients.Caller.roomsRecieved(new object[0]);
            }

            var roomService = new RoomService();
            var rooms = Task.Run(async () => await roomService.Get(department)).Result;

            Clients.Caller.roomsRecieved(rooms);
        }