Ejemplo n.º 1
0
        public User GetById(string id)
        {
            var result = _users.FindOne(e => e.Username.Equals(id));

            if (result == null)
            {
                _logger.LogInformation($"Non-existant user retrieval attempted");
                throw new System.Exception("User not found");
            }

            _logger.LogInformation($"user [{id}] retrieved from database");
            return(result);
        }
        public ModelsEntity GetById(ObjectId id)
        {
            var result = _models.FindOne(e => e.Id.Equals(id));

            if (result == null)
            {
                _logger.LogInformation($"Non-existant Models retrieval attempted");
                throw new System.Exception("Could not retreive entity");
            }

            _logger.LogInformation($"Models [{result.Name}] retrieved from database");
            return(result);
        }
Ejemplo n.º 3
0
        public TemplateEntity GetById(string id)
        {
            var result = _Templates.FindOne(e => e.TemplateID.Equals(id));

            if (result == null)
            {
                _logger.LogInformation($"Non-existant Template retrieval attempted");
                throw new System.Exception("Could not retreive entity");
            }

            _logger.LogInformation($"Template [{id}] retrieved from database");
            return(result);
        }