public FacultyResponseDTO Create(CreateFacultyRequestDTO requestDTO) { if (this.FindOneByNameAndCity(requestDTO.name, requestDTO.city) != null) { throw new EntityNotFoundException($"Faculty with name {requestDTO.name} in city {requestDTO.city} already exists!", GeneralConsts.MICROSERVICE_NAME); } Faculty faculty = new Faculty() { name = requestDTO.name, phone = requestDTO.phone, city = requestDTO.city }; faculty = this._queryExecutor.Execute <Faculty>(DatabaseConsts.USER_SCHEMA, this._sqlCommands.CREATE_FACULTY(faculty), this._modelMapper.MapToFaculty); return(this._autoMapper.Map <FacultyResponseDTO>(faculty)); }
public ActionResult <FacultyResponseDTO> HandleCreateFaculty(CreateFacultyRequestDTO requestDTO) { return(Ok(this._facultyService.Create(requestDTO))); }