Exemplo n.º 1
0
 public void ForeachAction(EmployeeAction action)
 {
     foreach (Employee employee in _employees)
     {
         action.Invoke(employee);
     }
 }
Exemplo n.º 2
0
        public IHttpActionResult Login(int id, string password)
        {
            EmployeeAction con   = new EmployeeAction();
            LoginInfo      login = con.getEmployeeInfo(id);

            if (login.PASSWRD == password)
            {
                return(Ok(id.ToString()));
            }
            else
            {
                return(Ok("Error"));
            }
        }
Exemplo n.º 3
0
        static void Main()
        {
            EmployeeManager manager = new EmployeeManager();

            manager.Add(new Employee()
            {
                Name = "Shlomo", Salary = 7000
            });
            manager.Add(new Employee()
            {
                Name = "Noam", Salary = 17000
            });
            manager.Add(new Employee()
            {
                Name = "Yossi", Salary = 5000
            });
            manager.Add(new Employee()
            {
                Name = "Tomer", Salary = 2000
            });

            Console.WriteLine("Data");
            manager.Print();
            Console.WriteLine("\nSorting...");

            //using lambada
            manager.Sort((x, y) => { return(x.Salary.CompareTo(y.Salary)); });
            manager.Print();
            Console.WriteLine("\nSorting...");

            //using anonymous decleration
            manager.Sort(delegate(Employee x, Employee y) { return(x.Name.CompareTo(y.Name)); });
            manager.Print();
            Console.WriteLine("\nSorting...");

            //using a declared function
            manager.Sort(CompareBySalary);
            manager.Print();

            //
            EmployeeAction employeeAction = new EmployeeAction(PrintEmployee);

            manager.ForeachAction(employeeAction);
        }
Exemplo n.º 4
0
        public void insertEmployee([FromBody] Employee emp)
        {
            EmployeeAction con = new EmployeeAction();

            con.insertEmployee(emp.ID, emp.PASSWRD, emp.FNAME, emp.LNAME, emp.ROLEID);
        }
Exemplo n.º 5
0
        public IHttpActionResult getEmployeeByID(int id)
        {
            EmployeeAction con = new EmployeeAction();

            return(Ok(con.getEmployeeByID(id)));
        }
Exemplo n.º 6
0
        public IHttpActionResult getEmployeeByRole(int idrole)
        {
            EmployeeAction con = new EmployeeAction();

            return(Ok(con.getEmployeeByROLE(idrole)));
        }
Exemplo n.º 7
0
        public IHttpActionResult GetAllEmployees()
        {
            EmployeeAction emp = new EmployeeAction();

            return(Ok(emp.getAllEmployee()));
        }