I have a table with Id and Status as string. The user can enter two or more text and with a click of a button they should be all written to database. So far I tried to have this
public async Task OnPostAddRCAMainAsync(string idinv, string app)
{
var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);
var orgid = await _context.UsersData.Where(a => a.Id == userId).Select(a => a.OrgID).SingleOrDefaultAsync();
var idrca = await _context.InvestigationRCAs.Where(s => s.OrgID == orgid && s.IdINV == idinv).Select(s => s.IdRCA).FirstOrDefaultAsync();
var newRCAMain = new RCAMain()
{
IdRCA = idrca
};
if (await TryUpdateModelAsync(newRCAMain, "RCAMain",
s => s.Status
))
{
_context.RCAMains.AddRange(newRCAMain);
await _context.SaveChangesAsync();
return RedirectToPage("/SRM/Investigation/RCA", new { idinv, app });
}
return Page();
}
but no Status is added, only the IdRCA

Sachin SinghPosted Aug 8, 2021, 10:11 AM
class
="text-left h5 ml-1">Root Causesclass="text-left h5 ml-1" style="color:Marius VasilePosted Aug 9, 2021, 6:25 AM
Marius VasilePosted Aug 8, 2021, 5:32 PM
Thank you sachin, I've implemented your solution and I have the following error message
ArgumentNullException: Value cannot be null. (Parameter 'entities')