Beispiel #1
0
        public ActionResult Index()
        {
            var emp_data = _services.GetEmployeeData();

            if (emp_data.Count == 0)
            {
                return(NotFound());
            }

            return(View(emp_data.ToList()));
        }
Beispiel #2
0
        // GET: Employee
        public ActionResult Index(string searchBy, string search = "", Boolean?isActive = null)
        {
            var emp_data = _services.GetEmployeeData();

            if (emp_data.Count == 0)
            {
                return(View());
            }

            if (searchBy == "Name" && search != null)
            {
                emp_data = emp_data.Where(x => x.Active == isActive).ToList();
                return(View(emp_data.Where(x => x.EmployeeName.ToLower().Contains(search.ToLower())).ToList()));
            }
            else if (searchBy == "UserID" && search != null)
            {
                emp_data = emp_data.Where(x => x.Active == isActive).ToList();
                return(View(emp_data.Where(x => x.UserID == Convert.ToInt32(search)).ToList()));
            }
            else if (isActive != null)
            {
                emp_data = emp_data.Where(x => x.Active == isActive).ToList();
            }
            return(View(emp_data.ToList()));
        }