I found a bug for my Employee edition page, where I simply am able to change information about a selected employee (name, login, password etc.)
_service.Edit(objToEdit)
Sends me to the following for edition:
public bool Edit(Employee objEmployee)
{            
    if (!Validate(objEmployee))
        return false;
    try
    {
        _repository.Edit(objEmployee);
    }
    catch
    {
        return false;
    }
    return true;
}
That finally goes to the following to save the changes :
public Employee Edit(Employee objEmployee) 
{
     var Original = Get(objEmployee.Login);
     if (Original != null)
     {
         var attachedEmp = _entities.Entry(Original);
         attachedEmp.CurrentValues.SetValues(objEmployee);
     }
     else
     {
         _entities.Employees.Add(objEmployee);
     }
     _entities.SaveChanges();
     return objEmployee;
 }
But once I reach _entities.SaveChanges() I get the following error :
The UPDATE statement conflicted with the FOREIGN KEY SAME TABLE constraint "FK_EmployeeEmployee2". The conflict occurred in database "CRAV34", table "dbo.Employee", column 'Login'. The statement has been terminated.
I looked it up but couldn't find anything that truly helped me. I have recently updated my database with new employees, edition works on old ones but seems to have this error on new ones.
Any help would be greatly appreciated !

 
    