예제 #1
0
        public dynamic Poststaff([FromBody] StaffRequestDto staffDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            try
            {
                staffDto = staffRepository.addStaff(staffDto);
            }
            catch (Exception e)
            {
                if (staffRepository.staffExists(staffDto.id))
                {
                    return(Conflict());
                }
                else
                {
                    throw e;
                }
            }

            return(Ok(staffDto));
        }