Esempio n. 1
0
        public ActionResult <EmployeeReadDto> Create(EmployeeCreateDto employeeCreateDto)
        {
            var employeeModel = _mapper.Map <Employee>(employeeCreateDto);

            _employeeRepo.CreateNewEmployee(employeeModel);
            _employeeRepo.SaveChanges();

            var empReadDto = _mapper.Map <EmployeeReadDto>(employeeModel);

            return(CreatedAtRoute(nameof(GetEmployee), new { Id = empReadDto.Id }, empReadDto));
        }