Example #1
0
        public ActionResult GetTeachers(DtoEmployeeSearch search)
        {
            search.Status   = StatusEnum.效;
            search.RoleCode = "teacher";

            EmployeeBll bll       = new EmployeeBll();
            var         employees = bll.GetEmployees(search);

            Dictionary <int, string> dic = new Dictionary <int, string>();

            employees.ToList().ForEach(e => dic.Add(e.Id, e.Name));
            var result = OptionFactory.CreateOptions(dic);

            return(Select2(result));
        }
 public IActionResult GetEmployees(string companyCode)
 {
     try
     {
         var employees = _employee.GetEmployees <EmployeeViewModel>(companyCode);
         if (employees.Count > 0)
         {
             return(Ok(new { status = true, result = employees }));
         }
         else
         {
             return(NotFound(new { status = false, result = "No Employee found" }));
         }
     }
     catch (InvalidException err) { return(Ok(new { status = false, result = err.Message })); }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Example #3
0
 public List <Employees> GetEmployees()
 {
     return(employeeBll.GetEmployees());
 }
 public async Task <IEnumerable <EmployeeDto> > Get()
 {
     return(await EmployeeBll.GetEmployees());
 }