Пример #1
0
        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);
        }
Пример #2
0
 public IActionResult Index()
 {
     return(View(_employeeRespository.GetAllEmployees()));
 }