コード例 #1
0
        public void RegisterUser(User user, string OUTPUT)
        {
            SqlCommand command = new SqlCommand();

            SqlParameter parameter = new SqlParameter();

            parameter.ParameterName = @"ResponseMessage";
            parameter.IsNullable    = true;
            parameter.SqlDbType     = System.Data.SqlDbType.VarChar;
            parameter.Direction     = System.Data.ParameterDirection.Output;
            parameter.Size          = 50;


            command.Parameters.Add(parameter);

            RelationalDatabaseFacadeExtensions.ExecuteSqlRaw("EXEC RegisterUser @UserId, @FirstName, @LastName, @Email, @UserPassword",
                                                             new SqlParameter("@UserId", user.UserId),
                                                             new SqlParameter("@FirstName", user.FirstName),
                                                             new SqlParameter("@LastName", user.LastName),
                                                             new SqlParameter("@Email", user.Email),
                                                             new SqlParameter("@UserPassword", user.UserPassword.ToString()), parameter);

            //return StatusCode(180);
        }
コード例 #2
0
 /// <summary>
 /// Executes the SQL command.
 /// </summary>
 /// <param name="sql">The SQL.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns>
 /// int.
 /// </returns>
 public int ExecuteSqlCommand(string sql, params object[] parameters)
 => RelationalDatabaseFacadeExtensions.ExecuteSqlRaw(this.DbContext.Database, sql, parameters);