Beispiel #1
0
        public async Task<ActionResult> Upload(FileUploadViewModel model)
        {
            int t1 = Thread.CurrentThread.ManagedThreadId;
            List<Employee> employees = await Task.Factory.StartNew(() => GetEmployees(model));
            int t2 = Thread.CurrentThread.ManagedThreadId;

            EmployeeBusinessLayer ebl = new EmployeeBusinessLayer();
            ebl.UploadEmployees(employees);
            return RedirectToAction("Index", "Employee");
        }
 public async Task<ActionResult> Upload(FileUploadViewModel model)
 {
     int t1 = Thread.CurrentThread.ManagedThreadId;
     List<Employee> employees = await Task.Factory.StartNew<List<Employee>>(() => GetEmployees(model));
     EmployeeBusinessLayer ebl = new EmployeeBusinessLayer();
     ebl.UploadEmployees(employees);
     EmployeeListViewModel vm = new EmployeeListViewModel();
     vm.Employees = new List<EmployeeViewModel>();
     foreach (var item in employees)
     {
         EmployeeViewModel evm = new EmployeeViewModel();
         evm.EmployeeName = item.FirstName + " " + item.LastName;
         evm.Salary = item.Salary.ToString("c");
         evm.SalaryColor = item.Salary > 15000 ? "yellow" : "green";
         vm.Employees.Add(evm);
     }
     return Json(vm);
 }