Esempio n. 1
0
        public ActionResult Edit(string id)
        {
            var model = _floorRepository.Get(id);

            if (null == model || model.OrganizationId != CurrentOrganization.Id)
            {
                return(HttpNotFound());
            }

            ViewBag.Building = _buildingRepository.Get(model.BuildingId)?.Name;
            return(View(model));
        }
Esempio n. 2
0
        public ActionResult Create(RoomMetadataEntity model)
        {
            var floor = _floorRepository.Get(model.FloorId);

            if (floor.OrganizationId != CurrentOrganization.Id)
            {
                return(HttpNotFound());
            }

            model.Id             = null;
            model.OrganizationId = CurrentOrganization.Id;
            model.BuildingId     = floor.BuildingId;
            _roomRepository.Update(model);
            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
        public FloorDto GetFloor(int id)
        {
            var floor = _floorRepository.Get(id);

            if (floor == null)
            {
                return(null);
            }

            return(DTOMapper.GetFloorDto(floor));
        }
Esempio n. 4
0
        public ActionResult Edit(string id)
        {
            var model = _deviceRepository.Get(id);

            if (null == model || model.OrganizationId != CurrentOrganization.Id)
            {
                return(HttpNotFound());
            }

            var roomId = (model.ControlledRoomIds ?? new string[0]).FirstOrDefault();
            var room   = null == roomId ? null : _roomMetadataRepository.GetRoomInfo(roomId);

            ViewBag.Building = _buildingRepository.Get(model.BuildingId)?.Name;
            ViewBag.Floor    = _floorRepository.Get(room?.FloorId)?.Name;
            ViewBag.Room     = room?.RoomAddress;
            return(View(model));
        }
        public RoomInfo GetStaticInfo(IRoom room)
        {
            var roomName = _exchangeConferenceRoomDiscoveryService.GetRoomName(room.RoomAddress).Result;

            if (null == roomName)
            {
                return(null);
            }

            var canControl = CanControl(room);

            if (canControl && _useChangeNotification)
            {
                // make sure we track rooms we're controlling
                _changeNotificationService.TrackRoom(room, _exchangeServiceManager, _contextService.CurrentOrganization);
            }

            var building = _buildingRepository.Get(room.BuildingId) ?? new BuildingEntity();
            var floor    = _floorRepository.Get(room.FloorId) ?? new FloorEntity();

            return(BuildRoomInfo(roomName, canControl, (RoomMetadataEntity)room, building, floor));
        }