Im using MVC 3, EF Model first for my web application.
I have a table with a list of employees, I want to be able to inactivate employees and also be able to delete employees. I have no problems with deleting employees but I also want to be able to inactivate employees so people cant seach for the employee or use em in other type of functionality, though, I still want them to exist in my database.
Add status field to the table. Employee will have different status 1 – Online 2 – Inactive 3 – Deleted. this way you can keep all your employees in database but you’ll be able to pull out employees that are only currently hired(online).
Context.Get().Employees.Where(x => x.Status == EmployeeStatus.Online);And EmployeeStatus enum:
EDIT:
You may need to do some additional parsing to get the enum to work that way; on the other hand, you can just use pull data by int value but enum is much clearer.