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); }
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); }
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); }