• DeleteEmployeeByID() function
  • UpdateEmployee() function
  • Create the Web API project
  • GetEmployeeById () function




    Download 2.23 Mb.
    bet5/16
    Sana20.03.2020
    Hajmi2.23 Mb.
    #8262
    1   2   3   4   5   6   7   8   9   ...   16

    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.

    Create the Web API project


    Start Visual Studio 2015. From the File menu, select New > Project.



    Select the 
    Katalog: Blog -> wp-content -> uploads -> 2016

    Download 2.23 Mb.
    1   2   3   4   5   6   7   8   9   ...   16




    Download 2.23 Mb.