public async Task<ActionResult> Index() { var deviceService = new DeviceService(); var mac = NativeMethods.GetMacAddress(Request.UserHostAddress); var device = await deviceService.Get(Request.UserHostAddress, mac); var isLocalized = device != null && device.IsLocalized; var callTypeService = new CallTypeService(); var calltypes = await callTypeService.Get(); var localizationResponse = Session["localization_response"] as LocalizationResponse; var message = string.Empty; if (localizationResponse != null) { message = localizationResponse.Message ?? string.Empty; Session["localization_response"] = null; } var model = new IndexViewModel { IpAddress = Request.UserHostAddress, MacAddress = mac, Message = message, IsLocalized = isLocalized, CallTypes = calltypes }; return View(model); }
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); }