Query and show data from database all in view .net core

Query and show data from database all in view .net core,database,.net-core,foreach,Database,.net Core,Foreach,I'm wondering it is possible to show data from database (write the query and looping the data) in view (cshtml file), like in php, you can create query and show the data inside foreach loop all in view, code example below (Codeigniter): <html> <body> <?php $records = $this->db->get("tbl_detail_penjualan a")->result(); foreach ($records as $record): ?> <tr role="row" > <td><?php echo $record->jumbel ?></td> <td ><?php echo $record-&g

I'm wondering it is possible to show data from database (write the query and looping the data) in view (cshtml file), like in php, you can create query and show the data inside foreach loop all in view, code example below (Codeigniter):

<html>
<body>
<?php
$records = $this->db->get("tbl_detail_penjualan a")->result();
foreach ($records as $record):
?>
<tr role="row" >
<td><?php echo $record->jumbel ?></td>
<td ><?php echo $record->total_harga ?></td>
<td><?php echo $pelanggan['nama_pelanggan'] ?></td>
<td><?php echo $record->tanggal ?></td>
<td ><?php echo $ot['nama_outlet'] ?></td>
</tr>
<?php
endforeach;
?>


#1

Please, can anyone answer this ?? :(

#2

It is possible, using Razor Pages, which do not use controllers. See here: docs.microsoft.com/en-us/aspnet/core/razor-pages.