コード例 #1
0
        public async Task <ActionResult <LeaveTypeReadDto> > CreateLeaveTypeAsync(LeaveTypeCreateDto leaveTypeCreateDto)
        {
            var leaveItems = _mapper.Map <LeaveType>(leaveTypeCreateDto);
            await _leaveType.CreateLeaveTypeAsync(leaveItems);

            await _leaveType.SaveChanges();

            var leaveReadDto = _mapper.Map <LeaveTypeReadDto>(leaveItems);

            return(CreatedAtRoute(nameof(GetLeaveTypeByIdAsync), new { id = leaveReadDto.Id }, leaveReadDto));
        }