public void AddEmployee(EmployeeDto employee) { var employeeEntity = _dbContext.Employees.FirstOrDefault(x => x.ID == employee.ID); if (employeeEntity != null) { throw new Exception($"Employee already exist in the system."); } var newEmployeeEntity = new Data.Employee { Name = employee.Name, ManagerID = employee.ManagerID, Active = true }; _dbContext.Employees.Add(newEmployeeEntity); _dbContext.SaveChanges(); }
partial void DeleteEmployee(Employee instance);
partial void UpdateEmployee(Employee instance);
partial void InsertEmployee(Employee instance);
private void detach_Employees(Employee entity) { this.SendPropertyChanging(); entity.Employee1 = null; }
private void attach_Employees(Employee entity) { this.SendPropertyChanging(); entity.Employee1 = this; }