Exemplo n.º 1
0
        private Task <Access> RecordInRepository(string doorId, string personId, bool granted, double temperature)
        {
            try
            {
                var newAccess = new Access
                {
                    DoorId      = doorId,
                    Granted     = granted,
                    PersonId    = personId,
                    Temperature = temperature,
                    Timestamp   = DateTime.UtcNow
                };

                return(_accessRepository.CreateAccessAsync(newAccess));
            }
            catch (Exception exception)
            {
                _logger.LogError(exception, "Failed to record access in data repository.");
                throw;
            }
        }