i have 2 tables like that:
Table1(AdjSapanca)
ItemID| Kategori |
------+----------+
7 | 25 |
6 | 26 |
5 | 27 |
4 | 28 |
3 | 29 |
2 | 30 |
1 | 31 |
Table2(Kategoris)
ID | DisplayN |
------+----------+
25 | Testo |
26 | Testo1 |
27 | Testo2 |
28 | Testo3 |
29 | Testo4 |
30 | Testo5 |
31 | Testo6 |
What I'm trying to do:
Print DisplayN corresponding to ITEMID to table row.
item.Id
at my code gives me the value of ItemID at AdjSapanca table.
My last point at below:
@if (@Model.Kategoris.Where(p => p.Id == item.Id) != null)
{
<td>
@Model.Kategoris.Where(p => p.Id == Model.KategoriAdjSapanca.Where(x => x.Id == p.Id).FirstOrDefault().Kategori).FirstOrDefault().DisplayN
</td>
and i'm getting that error:
ArgumentNullException: Value cannot be null. (Parameter 'source') System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument) System.Linq.Enumerable.Where(IEnumerable source, Func<TSource, bool> predicate) AspNetCore.Views_Home_Index.b__12_10(KategoriT p) in Index.cshtml + @Model.Kategoris.Where(p => p.Id == Model.KategoriAdjSapanca.Where(x => x.Id == p.Id).FirstOrDefault().Kategori).FirstOrDefault().Kategori
Any suggestions? What i am doing wrong?