Hi @Ali Yılmaz ,
Assume that you can get the value from excel, here is a simple demo about how to show the data to the table:
Model
public class BaseEntity
{
public string ArtikelName { get; set; }
public string TicariTanim { get; set; }
public string Karisim { get; set; }
public string Mensei { get; set; }
public string GtipNo { get; set; }
public string Marka { get; set; }
public string Artikel { get; set; }
public string KumasKodu { get; set; }
public decimal BirimFiyat { get; set; }
public decimal ToplamFiyat { get; set; }
public decimal Agirlik { get; set; }
public int Adet { get; set; }
}
public class Dusumler : BaseEntity
{
public string BeyannameNO { get; set; }
public string StokKodu { get; set; }
public int KoliAdet { get; set; }
}
public class VM_Dusum
{
public List<Dusumler> Dusumler { get; set; }
}
View
<table class="table table-bordered mb-0">
<thead>
<tr>
<th>Stok Kodu</th>
<th>Artikel Adı</th>
<th>Beyanname No</th>
<th>Ticari Tanım</th>
<th>Karışım</th>
<th>Ağırlık</th>
<th>Menşei</th>
<th>Gtip No</th>
<th>Marka</th>
<th>Artikel</th>
<th>Kumaş Kodu</th>
<th>Birim Fiyat</th>
<th>Toplam Fiyat</th>
<th>Adet</th>
<th>Koli Adet</th>
</tr>
</thead>
<tbody>
@if (Model.Dusumler != null)
{
@foreach (var item in Model.Dusumler)
{
<tr class="bg-dark text-white">
<td>@Html.DisplayFor(modelItem=>item.StokKodu)</td>
<td>@Html.DisplayFor(modelItem=>item.Artikel)</td>
<td>@Html.DisplayFor(modelItem=>item.BeyannameNO)</td>
<td>@Html.DisplayFor(modelItem=>item.TicariTanim)</td>
<td>@Html.DisplayFor(modelItem=>item.Karisim)</td>
@*more property......*@
</tr>
}
}
</tbody>
</table>
Controller
public async Task<IActionResult> Index()
{
//more code......
Dusumler dusum = new Dusumler();
dusum.StokKodu = stok;
//......
dusum.KoliAdet = koliadet;
VM_Dusum dusums = ne w VM_Dusum()
{
Dusumler=ne w List<Dusumler>() //change here.......
};
dusums.Dusumler.Add(dusum);
r eturn View(dusums); //change here..........
}
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best Regards,
Rena