public async Task <GetRobotDto> CreateRobotAsync(CreateRobotDto item, CancellationToken ct = default) { var newItem = _mapper.Map <Robot>(item); _unitOfWork.RobotRepository.Create(newItem); await _unitOfWork.CommitAsync(ct); return(_mapper.Map <GetRobotDto>(newItem)); }
public async Task <ActionResult> CreateRobotAsync([FromBody] CreateRobotDto robot) { BuildUserPrincipal(); robot.UserId = ApiUser.Id; var result = await _robotService.CreateRobotAsync(robot); _client.Enqueue(() => _robotService.SendNotificationByUserInterestsAsync(CancellationToken.None)); return(StatusCode((int)HttpStatusCode.Created, Json(JsonResultData.Success(result)))); }