Starr Duskk
asked on
Convert PHP to .NET (for Datatables)
I am looking at the datatables example of parent/child, and it has the server side code written in PHP to pull the data.
Can you please explain/convert this into VB.NET or C# so I can understand how to use it with my own data?
https://datatables.net/blog/2019-01-11
The sites.php and users.php appear to be under the "server-side php" topics.
Thanks!
Starr
Can you please explain/convert this into VB.NET or C# so I can understand how to use it with my own data?
https://datatables.net/blog/2019-01-11
The sites.php and users.php appear to be under the "server-side php" topics.
Editor::inst( $db, 'sites' )
->fields(
Field::inst( 'id' )->set( false ),
Field::inst( 'name' )->validator( 'Validate::notEmpty' )
)
->join(
Mjoin::inst( 'users' )
->link( 'sites.id', 'users.site' )
->fields(
Field::inst( 'id' )
)
)
->process( $_POST )
->json();
if ( ! isset($_POST['site']) || ! is_numeric($_POST['site']) ) {
echo json_encode( [ "data" => [] ] );
}
else {
Editor::inst( $db, 'users' )
->field(
Field::inst( 'users.first_name' ),
Field::inst( 'users.last_name' ),
Field::inst( 'users.phone' ),
Field::inst( 'users.site' )
->options( 'sites', 'id', 'name' )
->validator( 'Validate::dbValues' ),
Field::inst( 'sites.name' )
)
->leftJoin( 'sites', 'sites.id', '=', 'users.site' )
->where( 'site', $_POST['site'] )
->process($_POST)
->json();
}
Thanks!
Starr
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.