Exemplo n.º 1
0
        public AuthPasswordModel Authenticate(AuthModel user)
        {
            try
            {
                using (var connection = _odsHelper.Connection())
                {
                    var sql = @"
SELECT  PasswordHash
        ,PasswordSalt
FROM    AuthUsers
WHERE   UserName = @UserName";

                    connection.Open();

                    var parameters = new DynamicParameters();
                    parameters.Add("@UserName", user.UserName, DbType.String, ParameterDirection.Input);

                    return(connection.QueryFirst <AuthPasswordModel>(sql, parameters, commandType: CommandType.Text));
                }
            }
            catch (Exception ex)
            {
                _odsHelper.Logger().LogError(ex, "Error authenticating user");

                return(null);
            }
        }
        public IEnumerable <SampleModel> ListSamples()
        {
            try
            {
                using (var connection = _odsHelper.Connection())
                {
                    var sql = @"
SELECT  id
        ,value
FROM    Samples";

                    connection.Open();
                    return(connection.Query <SampleModel>(sql));
                }
            }
            catch (Exception ex)
            {
                _odsHelper.Logger().LogError(ex, "Error retrieving samples");

                return(null);
            }
        }