|
GetEmployeeById () function
|
bet | 5/16 | Sana | 20.03.2020 | Hajmi | 2,23 Mb. | | #8262 |
GetEmployeeById () function, This function is responsible for returning the employee information based on the employee id which is passed to the function. In LINQ, there is a method(Find()) available to look for the object based on the given condition. This Find () method will check and return the employee information in the employee list based on the employee id. DeleteEmployeeByID() function, This function is responsible for deleting the single employee from the employees collection. First, var employee = employees.Find(i => i.EmployeeID == employeeId); This will find the employee based on employee id. Empoyees.Remove(employee); this remove() function will remove the employee object from the employees list. UpdateEmployee() function, This function will get employee id and employee object to be modified as input parameters. First, var employee = employees.Find(i => i.EmployeeID == employeeId); This will find the employee based on employee id from the employees list. Then this employee object entities will be replaced by the employee object that passed as inplut parameters.
Build this project by clicking Ctrl+Shift+B in order to create dll as this project will be used as a reference for the other projects and make sure there is no build error.
Start Visual Studio 2015. From the File menu, select New > Project.
Select the
|
| |