public void AddEmployee() { using (DataAcc.HR_DeptEntities myEnt = new DataAcc.HR_DeptEntities()) { DataAcc.Employee newEmployee = new DataAcc.Employee() { emp_code = _Code, emp_name = _Name, emp_designation = _Designation, emp_date_appointed = _Date_Appointed, dept_code = _dept_Code }; myEnt.AddToEmployees(newEmployee); myEnt.SaveChanges(); } }
/// <summary> /// Create a new Employee object. /// </summary> /// <param name="emp_code">Initial value of the emp_code property.</param> public static Employee CreateEmployee(global::System.Int32 emp_code) { Employee employee = new Employee(); employee.emp_code = emp_code; return employee; }
/// <summary> /// Deprecated Method for adding a new object to the Employees EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToEmployees(Employee employee) { base.AddObject("Employees", employee); }