EDIT - as requested, this is the view...
--start edit
@model salesWebTest.viewModel.vwbooking
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html
Your not checking if vwbooking.traces == null before calling it. While you might expect that .ToList() can protect you from this, Entity Framework can be quirky (anecdotal). Safeguard your call with
if (ModelState.IsValid)
{
db.bookings.Attach(vwbooking.bookings);
db.Entry(vwbooking.bookings).State = EntityState.Modified;
if(vwbooking.traces != null)
{
vwbooking.traces.ToList().ForEach( //THE ERROR OCCURS HERE
t =>
{
db.traces.Attach(t);
db.Entry(t).State = EntityState.Modified;
}
);
db.SaveChanges();
}
}
and you should be fine.