I don't understand why the table adds only one value and it doesn't add the second one. For the HazardClass is working fine but for HazardDetails is not
Update. It seems that the problem I have is with:
- <div class="form-control">
- @Html.DisplayFor(model => model.HazardClass.IdHC)
- </div>
which also should be source for input
- var emptyHaz = new HazardDetail();
-
- if (await TryUpdateModelAsync<HazardDetail>(emptyHaz, "hazardDetail", s => s.IdHC, s => s.HazDetail))
- {
- _context.HazardDetails.Add(emptyHaz);
- await _context.SaveChangesAsync();
- return RedirectToPage("./Index");
- }
So, the question is, how do I get the @html..... to be input for IdHC?