I have a list which contains multiple records. I like to use the AddObject to create those records but what is happening is that it creates just the last record in the list.
Here is the code
foreach (var item in invlist) {
invmodel.tblrec.FirstName = item.FirstName;
invmodel.tblrec.LastName = item.LastName;
db.tblRec.AddObject(invmodel.tblrec);
}
db.SaveChanges();