예제 #1
0
        public async Task <IActionResult> PostFaculty([FromBody] Faculty faculty)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            faculty = await _facultyService.AddAsync(faculty);

            return(Ok(faculty));
        }
예제 #2
0
        public async Task <IActionResult> AddAsync([FromBody] FacultyAddOrUpdateModel facultyAddOrUpdateModel)
        {
            if (!ModelState.IsValid)
            {
                BadRequest();
            }

            var facultyCreateDto = _mapper.Map <FacultyCreateDto>(facultyAddOrUpdateModel);
            var statusCode       = await _facultyService.AddAsync(facultyCreateDto);

            var response = _facultyResponseComposer.ComposeForCreate(statusCode, facultyCreateDto);

            return(response);
        }