I am trying to insert a new record into tblUser
and also update a record in tblEmployee
at the same time. The new record in tblUser
saves fine, but the update part of second table is not working. The complier reads tbEmp.IsUser = true;
this line though. What am I missing.
public void Save(tblUser objUser)
tblEmployee tbEmp = this.GetEmployeeRecordById(objUser.EmpId);
string abc = tbEmp.EmployeeCode;
tbEmp.IsUser = true;
public tblEmployee GetEmployeeRecordById(Guid gId)
return MYDB.tblEmployees.Where(e=>e.EmployeeId == gId).SingleOrDefault();
is known already and is not necessary that tblUser
has to Save First before updating tblEmployee
. To make sure, I checked 'abc', I get that employees code there...