This can't be hard but I can't figure it out. Tried several things. I know it's probably a type mismatch that I'm doing.
I have a table: FulfullmentBatch with UserId and ConfirmationCode
I have this loop. I want to populate batch.ConfirmationCode = consumer.ConfirmationCode
and batch.userId = consumer.id in that loop. The "foreach" loop I have won't work, of course.
public bool Update(IList<FulfillmentModel> model)
var batch = new List<FulfillmentBatch>();
foreach (var f in model)
var consumer =
_dataContext.Consumers.Where(m => ((m.Id == f.Id) && (f.Usertype == "C"))) //model has both consumer and dealer row. Use this flag to loop thru corresponding tables. Set in Stored proc
.SingleOrDefault(m => m.ConfirmationCode == f.ConfirmationCode);
if (consumer != null) consumer.SubmissionStatusId = (int)StatusSubmission.Status.Fulfilled;
//*** populate here
//** this won't work because batch is a new list
foreach (var row in batch)
row.UserId = consumer.Id;
row.ConfirmationCode = consumer.ConfirmationCode;