I am making a sales app using Blazor and Mudblazor and I have hit a bit of a dead end. I have a table called CarTbl and a table called CarPriceTbl. In CarPriceTbl, there is a column called CarId which is the primary key of the CarTbl table. I would like to know is there is a way to the details of each car to show on a view that uses CarPriceTbl instead of the CarId
tables: CarTbl
CarId
CarModel
CarPriceTbl
CarPriceTblId
CarId
Price
RazorView:
<MudTable FixedHeader="true" Height="450px" Elevation="25" Items="GetCars()" @bind-customer="car">
<HeaderContent>
<MudTh>Car Model</MudTh>
<MudTh>Price</MudTh>
</HeaderContent>
<RowTemplate>
<MudTd DataLabel="Car Model">@context.CarId</MudTd>
<MudTd DataLabel="Price">@context.Price</MudTd>
</RowTemplate>
</MudTable>
@code
{
private List<CarPriceTbl> car=new List <CarPriceTbl>();
private CarPriceTbl cars = new CarPriceTbl();
private List<CarTbl> carTbl = new List<CarTbl>();
private CarTbl carTbls = new CarTbl();
protected override async Task OnInitializedAsync()
{
GetCars();
}
private List<CarPriceTbl> GetCars()
{
car = carService.getCars();
return car;
}
}
carService.cs
public List<CarPriceTbl> GetCar()
{
return _dbContext.CarPriceTbl.ToList();
}