0

I have a database named "a" with the tables "aha", "aho" and "ahi".
How can I show them in one view on MVC?
I use ASP.NET Core 2.

<html>
    <div>aha.name</div>
    <div>aha.address</div>
    <div>aha.phonenumber</div>
    <div>aho.id</div>
    <div>aho.name</div>
    <div>aho.price</div>
    <div>ahi.name</div>
    <div>ahi.opentime</div>
    <div>ahi.closetime</div>
</html>
zx485
  • 28,498
  • 28
  • 50
  • 59
Bình An Lê
  • 5
  • 1
  • 4

1 Answers1

0

you should create a custom class or can say viewmodel of these classes or tables like

public class CustomTable {
public aha objaha{get;set;}
public aho objaho{get;set;}
public ahi objahi{get;set;}
}

import this CustomTable class as Model in the view and use it like

<html>
   <div>aha.name</div>   <div>Model.objaha.address</div>   <div>Model.objaha.phonenumber</div>
   <div>aho.id</div>   <div>Model.objaho.name</div>   <div>Model.objaho.price</div>
   <div>Model.objahi.opentime</div>   <div>Model.objahi.closetime</div>   
<html>
Sumit Sharma
  • 126
  • 2
  • 11