public async Task AddCallBackGroup(CallBackGroup callBackGroup, CancellationToken cancellationToken = default) { using var scope = _serviceScope.CreateScope(); await using var context = scope.ServiceProvider.GetRequiredService <BotDbContext>(); await context.CallBackGroups.AddAsync(callBackGroup, cancellationToken); await context.SaveChangesAsync(cancellationToken); }
private async Task AddCallBackGroup(ButtonMessage message, CancellationToken cancellationToken) { var callBack = new CallBackGroup(message.MessageCallBack); callBack.AddButtons(message.Buttons.Select(x => (x.Text, x.PressCallBack)) .ToArray()); await _callBackButtonProvider.AddCallBackGroup(callBack, cancellationToken); }