public async Task <ActionResult> CreateItemAsync([FromBody] UserRoleDTO userRoleDTO, CancellationToken cancellationToken) { var newItem = _mapper.Map <UserRole>(userRoleDTO); newItem = await _userRoleService.AddAsync(newItem, cancellationToken); if (newItem == null) { AssignToModelState(_userRoleService.Errors); return(ValidationProblem()); } return(CreatedAtAction(nameof(ItemByIdAsync), new { id = newItem.Id }, null)); }
public async Task <IActionResult> Post([FromBody] UserRoleModel model) { var responseData = await _userRoleService.AddAsync(model); return(Ok(responseData)); }
public async Task <IActionResult> AddNewUserRole([FromBody] UserRolePostDto userRolePostDto) { var userRoleResp = await userRoleService.AddAsync(userRolePostDto); return(CreatedAtAction("GetClient", new { id = userRoleResp.Id }, mapper.Map <UserRoleResponseDto>(userRoleResp))); }
public async Task <ActionResult <UserRoleDto> > AddUserRole(UserRoleDto userRoleDto) { return(await _userRoleService.AddAsync(userRoleDto)); }