Beispiel #1
0
    // get list of DTO employees
    public List <EmployeeDTOTable> getEmployees()
    {
        using (var context = new hctDBEntities())
        {
            List <Employee>         cl = context.Employees.OrderBy(i => i.Id).ToList();
            List <EmployeeDTOTable> dl = new List <EmployeeDTOTable>();

            foreach (Employee c in cl)
            {
                EmployeeDTOTable cdt = new EmployeeDTOTable();
                cdt.EmployeeID  = c.empID;
                cdt.FirstName   = c.fname;
                cdt.LastName    = c.lname;
                cdt.Status      = c.status;
                cdt.Email1      = c.email1;
                cdt.HomePhone   = c.homePhone;
                cdt.MobilePhone = c.mobilePhone;
                cdt.Rate        = String.Format("{0:0.00}", c.rate);

                ;
                dl.Add(cdt);
            }
            return(dl);
        }
    }
    // get list of DTO employees
    public List<EmployeeDTOTable> getEmployees()
    {
        using (var context = new hctDBEntities())
        {
            List<Employee> cl = context.Employees.OrderBy(i => i.Id).ToList();
            List<EmployeeDTOTable> dl = new List<EmployeeDTOTable>();

            foreach (Employee c in cl)
            {
                EmployeeDTOTable cdt = new EmployeeDTOTable();
                cdt.EmployeeID = c.empID;
                cdt.FirstName = c.fname;
                cdt.LastName = c.lname;
                cdt.Status = c.status;
                cdt.Email1 = c.email1;
                cdt.HomePhone = c.homePhone;
                cdt.MobilePhone = c.mobilePhone;
                cdt.Rate = String.Format("{0:0.00}", c.rate);

                ;
                dl.Add(cdt);
            }
            return dl;
        }
    }