public List <AdminProfileViewModel> GetAllEmployees() { List <AdminProfileViewModel> list = null; List <Employee> emplist = er.GetAllEmployees(); var config = new MapperConfiguration(cfg => { cfg.CreateMap <Employee, AdminProfileViewModel>(); cfg.CreateMap <Department, DepartmentViewModel>(); cfg.IgnoreUnmapped(); }); IMapper mapper = config.CreateMapper(); list = mapper.Map <List <Employee>, List <AdminProfileViewModel> >(emplist); return(list); }
public IActionResult Index() { return(View(_employeeRespository.GetAllEmployees())); }