public void ForeachAction(EmployeeAction action) { foreach (Employee employee in _employees) { action.Invoke(employee); } }
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")); } }
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); }
public void insertEmployee([FromBody] Employee emp) { EmployeeAction con = new EmployeeAction(); con.insertEmployee(emp.ID, emp.PASSWRD, emp.FNAME, emp.LNAME, emp.ROLEID); }
public IHttpActionResult getEmployeeByID(int id) { EmployeeAction con = new EmployeeAction(); return(Ok(con.getEmployeeByID(id))); }
public IHttpActionResult getEmployeeByRole(int idrole) { EmployeeAction con = new EmployeeAction(); return(Ok(con.getEmployeeByROLE(idrole))); }
public IHttpActionResult GetAllEmployees() { EmployeeAction emp = new EmployeeAction(); return(Ok(emp.getAllEmployee())); }