public ActionResult Search(SearchVM vm)
 {
     if (vm.FName == null && vm.Salary == 0)
     {
         vm.Employees = empService.GetList();
     }
     else
     {
         var searchEmployees = empService.Search(vm);
         vm.Employees = searchEmployees;
     }
     return(View(vm));
 }
Example #2
0
        public IHttpActionResult GetEmployeeByName(string name = null)
        {
            SearchEmployeeDTO searchEmployeeDTO = new SearchEmployeeDTO();

            if (name == null)
            {
                searchEmployeeDTO.Employees = empService.GetList();
            }
            else
            {
                var searchEmployees = empService.Search(name);
                searchEmployeeDTO.Employees = searchEmployees;
            }
            return(Ok(searchEmployeeDTO.Employees));
        }