public List<Employee> GetEmployees()
        {
            List<Employee> employees = new List<Employee>();
            Employee emp = new Employee();
            emp.name = "Maximiliano";
            emp.lastName = "Gomez Tumini";
            emp.salary = 12500;
            employees.Add(emp);

            return employees;
        }
Esempio n. 2
0
        public ActionResult Index()
        {
            //VIEW BAG
            ViewBag.Message = "Hello Index Page!! .NET is fun!!";

            Customer c = new Customer();
            c.name = "Maximiliano";
            c.address = "Gurruchaga 325";
            ViewBag.Customer = c;

            Employee e = new Employee();
            e.name = "Maximiliano";
            e.lastName = "Gomez Tumini";
            e.salary = 12500;
            ViewBag.Employee = e;

            //VIEW MODEL DATO SIMPLE
            EmployeeVM eVM = new EmployeeVM();
            eVM.name = e.name + " " + e.lastName;
            eVM.salary = e.salary;
            if (eVM.salary > 15000)
                eVM.salaryColor = "red";
            else
                eVM.salaryColor = "green";
            return View(eVM);

            //VIEW MODEL CON LISTA
            /*EmployeeListVM employeeList = new EmployeeListVM();
            EmployeeBusinessLayer empBL = new EmployeeBusinessLayer();
            List<Employee> employees = empBL.GetEmployees();

            List<EmployeeVM> empVM = new List<EmployeeVM>();

            foreach (Employee employee in employees) {
                EmployeeVM empViewModel = new EmployeeVM();
                empViewModel.name = employee.name + " " + employee.lastName;
                empViewModel.salary = employee.salary;
                if (employee.salary > 15000)
                {
                    empViewModel.salaryColor = "yellow";
                }
                else
                {
                    empViewModel.salaryColor = "green";
                }
                empVM.Add(empViewModel);
            }
            employeeList.employees = empVM;
            return View(employeeList);*/
        }