Exemple #1
0
        public ActionResult Unlock(Guid userGuid, Guid doorGuid)
        {
            var isAccessEnabled = _userDoorRepository.IsAccessEnabled(userGuid, doorGuid);

            if (isAccessEnabled)
            {
                _doorUnlocker.Unlock(doorGuid);

                _eventTracker.DoorOpen(userGuid, doorGuid);

                return(new ActionResult
                {
                    IsSuccess = true
                });
            }

            _eventTracker.DoorAccessDenied(userGuid, doorGuid);

            return(new ActionResult
            {
                IsSuccess = false,
                Message = "Access to door denied"
            });
        }