|
Add a EmployeeDataServices class
|
bet | 4/16 | Sana | 20.03.2020 | Hajmi | 2,23 Mb. | | #8262 |
EmployeeDataServices class will implement the IEmployeeDataSerivces interface which we created in Employees.Interface project. First, we need to add the .dll of Employees.Interface project.
To add dll, Right-click on References > Add references, then look for the Employees.Interface project’s bin folder, then select the Employees.Interface.dll , then Add.
And also, we need to reference the Employees.Model project to the Employees.DataService Project. To do so, just follow the same steps as described above. But here we need to look in Employees.Model project.
Next, add EmployeeDataServices class. Right-click the Employees.DataServices Project folder and select Add > New Item.
In the Add New Item dialog, select the Class template. Name the class EmployeeDataServices and click OK.
Then we need to add namespace of Employees.Interface project to the EmployeeDataServices.cs class.
Replace the generated code with the below:
In GetEmployees() Funtion,
We will create a new employees list object to fill with the employees details.
GetAllEmployees() Function ,is used to get the employees list and return the same to API Project.
|
| |