public ActionResult Index() { ViewBag.Message = "Employee Details"; var Rates = _departmentRoleService.Queryable().ToList(); var employee = (Session["Employee"] as Employee); var vm = new MainViewModel(); vm.Employee = employee; vm.Rates = Rates; vm.MaximumRate = 0; vm.MinimumRate = 0; return View(vm); }
public ActionResult SearchRates(int employeeId) { ViewBag.Message = "Sales Executive page."; var Rates = _departmentRoleService.Queryable().ToList(); var employee = _employeeService.Queryable().Where(f => f.EmployeeId == employeeId).FirstOrDefault(); var vm = new MainViewModel(); vm.Employee = employee; vm.Rates = Rates; vm.MaximumRate = 0; vm.MinimumRate = 0; return View(vm); }
//[ValidateAntiForgeryToken] public ActionResult SearchRates([Bind(Include = "MinimumRate, MaximumRate")] MainViewModel viewModel) { ViewBag.Message = "Sales Executive page."; var Rates = _departmentRoleService .Queryable() .Where(x => x.RatePerHour >= viewModel.MinimumRate && x.RatePerHour <= viewModel.MaximumRate) .ToList(); var vm = new MainViewModel(); vm.Employee = null; vm.Rates = Rates; vm.MaximumRate = viewModel.MaximumRate; vm.MinimumRate = viewModel.MinimumRate; return View(vm); }
public ActionResult SearchEmployeesInRole(int? departmentRoleId) { ViewBag.Message = "Sales Executive page."; if (departmentRoleId == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } var employees = _employeeService .Queryable() .Where(x => x.DepartmentRoleId == departmentRoleId) .ToList(); employees.ForEach(Dept => { Dept.DepartmentRole = _departmentRoleService.Queryable().Where(a => a.DepartmentRoleId == Dept.DepartmentRoleId).FirstOrDefault(); }); ViewBag.DepartmentRoleId = new SelectList(_departmentRoleService.Queryable().AsEnumerable(), "DepartmentRoleId", "Name", departmentRoleId); var vm = new MainViewModel(); vm.Employees = employees; return View(vm); }
//[ValidateAntiForgeryToken] public ActionResult SearchEmployeesInRole([Bind(Include = "departmentRoleId")] MainViewModel viewModel) { ViewBag.Message = "Sales Executive page."; var employees = _employeeService .Queryable() .Where(x => x.DepartmentRoleId == viewModel.DepartmentRoleId) .ToList(); ViewBag.DepartmentRoleId = new SelectList(_departmentRoleService.Queryable().AsEnumerable(), "DepartmentRoleId", "Name", viewModel.DepartmentRoleId); var vm = new MainViewModel(); vm.Employees = employees; return View(vm); }