Adding data to database on MVC 4.5 using Entity Framework. I am using the code below to add data to the the table a a new row the candidate may contain, will not be adding the entire row. I would like to know why this is not working, I get no compile or runtime errors.
var subject = db.subjects_tbl;
var sub = subject.CreateObject();
sub.subject_title = model.subject_title;
sub.language_Id = model.language_Id;
db.subjects_tbl.Attach(sub);
db.ObjectStateManager.ChangeObjectState(sub, EntityState.Added);
db.SaveChanges();