Exemple #1
0
        /// <summary>
        /// Gets the vehicle types.
        /// </summary>
        /// <returns></returns>
        public async Task <IEnumerable <string> > GetVehicleTypes()
        {
            using IDbConnection con = _dbConnectionProvider.GetConnectionInstance();
            IEnumerable <string> values = await con.QueryAsync <string>(StoredProcedureName.GetVehicleTypes);

            return(values);
        }
        /// <summary>
        /// Changes the password.
        /// </summary>
        /// <param name="changePassData">The change pass data.</param>
        /// <returns></returns>
        public async Task <bool> ChangePassword(ChangePasswordViewModel changePassData)
        {
            DynamicParameters parameters = new DynamicParameters();

            parameters.Add("@Username", changePassData.Username);
            parameters.Add("@CurrentPassword", changePassData.CurentPassword);
            parameters.Add("@NewPassword", changePassData.NewPassword);
            parameters.Add("@Result", dbType: DbType.Int32, direction: ParameterDirection.Output);

            using IDbConnection con = _dbConnectionProvider.GetConnectionInstance();
            await con.ExecuteAsync(StoredProcedureName.ChangePassword, parameters, commandType : CommandType.StoredProcedure);

            int result = parameters.Get <int>("@Result");

            if (result == 1)
            {
                return(true);
            }
            return(false);
        }