Um...I don;t think it will help, you will always fail the test.
If s.
EmployeeID
is an
integer
, then even if you convert it to a
string
:
employeeToDelete = ctx.Employees.Where(s => s.EmployeeID.ToString() == "EmployeeID").FirstOrDefault();
it will never match the string "EmployeeID", because it will be a string version of an integer: "1", "2", "3", ...
I think you need to go back to the value you want to compare it against, and work out how to get that as an integer value which represents the actual employee data you need rather than trying to convert each possible ID value to a string.
private void btnDelete_Click(object sender, RoutedEventArgs e)
{
using (var emp = new RubyEntities())
{
emp.Configuration.AutoDetectChangesEnabled = true;
var employeeToDelete = emp.Employees.ToList<Employee>();
emp.Employees.Remove(employeeToDelete.ElementAt<Employee>(0));
employeeViewSource.View.MoveCurrentToNext();
emp.SaveChanges();
employeeViewSource.View.Refresh();
}
}