public async Task <Position> AddNewPosition(PositionCreateCommand positionCreateCommand, CancellationToken cancellationToken) { var position = _mapper.Map <Position>(positionCreateCommand); await _databaseContext.Positions.AddAsync(position, cancellationToken); await _databaseContext.SaveChangesAsync(cancellationToken); await _notificationService.NotifyRecruiterAboutNewOpenPosition(position, cancellationToken); return(position); }
private async Task <ComposeExtensionResponse> CreateResponseToConfirmCreatePostingCommand(PositionCreateCommand data) { var position = await _positionService.GetById(data.PositionId); var extensionAttachment = _mapper.Map <ComposeExtensionAttachment>(position); return(new ComposeExtensionResponse { ComposeExtension = new ComposeExtensionResult { AttachmentLayout = AttachmentLayoutTypes.List, Type = "result", Attachments = new List <ComposeExtensionAttachment> { extensionAttachment } } }); }
private async Task <TaskModuleResponseEnvelope> CreateConfirmJobPostingTaskModuleResponse(PositionCreateCommand positionCreateCommand, CancellationToken cancellationToken) { var position = await _positionService.AddNewPosition(positionCreateCommand, cancellationToken); positionCreateCommand.CommandId = AppCommands.ConfirmCreationOfNewPosition; positionCreateCommand.PositionId = position.PositionId; var card = _mapper.Map <AdaptiveCard>(position); card.Actions = new List <AdaptiveAction> { new AdaptiveSubmitAction { Title = "Confirm posting", Data = positionCreateCommand }, new AdaptiveSubmitAction { Title = "Cancel" } }; return(new TaskModuleResponseEnvelope { Task = new TaskModuleContinueResponse { Type = "continue", Value = new TaskModuleTaskInfo { Card = card.ToAttachment(), Title = "Confirm new posting", Width = "medium", Height = "medium" } } }); }
private async Task <InvokeResponse> CreateConfirmJobPostingTaskModuleResponse(ITurnContext turnContext, PositionCreateCommand positionCreateCommand, CancellationToken cancellationToken) { var position = await _positionService.AddNewPosition(positionCreateCommand, cancellationToken); positionCreateCommand.CommandId = AppCommands.ConfirmCreationOfNewPosition; positionCreateCommand.PositionId = position.PositionId; var positionsTemplate = new PositionTemplateModel { Items = new List <Position> { position }, ButtonActions = new List <AdaptiveAction> { new AdaptiveSubmitAction { Title = "Confirm posting", Data = positionCreateCommand }, new AdaptiveSubmitAction { Title = "Cancel" } } }; var messageActivity = await _positionsTemplate.RenderTemplate(turnContext, null, TemplateConstants.PositionAsAdaptiveCardWithMultipleItems, positionsTemplate); var actionResponse = new MessagingExtensionActionResponse { Task = new TaskModuleContinueResponse { Type = "continue", Value = new TaskModuleTaskInfo { Card = messageActivity.Attachments.First(), Title = "Confirm new posting", Width = "medium", Height = "medium" } } }; return(_mapper.Map <MessagingExtensionActionResponse, InvokeResponse>(actionResponse)); }